formatPvalue: Pretty formatting of _p_ values

Description Usage Arguments Value See Also Examples

View source: R/formatPvalue.R

Description

Pretty formatting of p values

Usage

1
formatPvalue(values, digits = 3, spaces = TRUE, includeP = TRUE)

Arguments

values

The p-values to format.

digits

The number of digits to round to. Numbers smaller than this number will be shown as <.001 or <.0001 etc.

spaces

Whether to include spaces between symbols, operators, and digits.

includeP

Whether to include the 'p' and '='-symbol in the results (the '<' symbol is always included).

Value

A formatted P value, roughly according to APA style guidelines. This means that the noZero function is used to remove the zero preceding the decimal point, and p values that would round to zero given the requested number of digits are shown as e.g. p<.001.

See Also

formatCI(), formatR(), noZero()

Examples

1
2
3
4
formatPvalue(cor.test(mtcars$mpg,
                      mtcars$disp)$p.value);
formatPvalue(cor.test(mtcars$drat,
                      mtcars$qsec)$p.value);

rosetta documentation built on Nov. 14, 2021, 1:06 a.m.