Following conventions of many medical journals, this function rounds a p-value to two digits (if p > 0.05) or three digits (if 0.001 <= p < 0.05), or returns an inequality of "< 0.001" (if p < 0.001).

roundp(pee, equal = FALSE)

Arguments

pee

Numeric p-vale

equal

Show equal sign if p > 0.001? Defaults to FALSE

Value

String: rounded number, preceded by equal sign (unless equal = FALSE) or less-than sign.

Examples

roundp(0.1138)
#> [1] "0.11"
roundp(c(0.01138, 0.0000138))
#> [1] "0.011"   "< 0.001"

# Include equal sign
roundp(0.01138, equal = TRUE)
#> [1] "= 0.011"