to_lessthan: Function for converting p values to '< 0.01' (or desired...

View source: R/to_lessthan.R

to_lessthanR Documentation

Function for converting p values to '< 0.01' (or desired power of 10)

Description

This function is best used for transforming numeric pvalue columns into character representation based on desired number of sig figs. Defaults to replacing numeric vectors below 0.01 with '<0.01'

Usage

to_lessthan(x, digits = 2)

Arguments

x

Numeric vector

digits

desired number of digits to round to

Value

character vector with values below rounding limit coerced to '< x'

Examples

data(mtcars)

Remove Toyota corona (row 21) to get larger smaller pvalue for illustration
mod = glm(am ~  hp + wt ,
          data = mtcars[-21,], family = binomial())

tab = glm_ORs(mod)

tab$p_1d = to_lessthan(tab$p, digits = 1)
tab$p_2d = to_lessthan(tab$p, digits = 2)

tab


Ajfrick/ajfhelpR documentation built on June 30, 2023, 12:56 a.m.