roundp: Round and Format p-Values

View source: R/vectors.R

roundpR Documentation

Round and Format p-Values

Description

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).

Usage

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)
roundp(c(0.01138, 0.0000138))

# Include equal sign
roundp(0.01138, equal = TRUE)

stopsack/khsmisc documentation built on Sept. 22, 2023, 12:26 p.m.