Format p-Values

Description

Formats p-values in a desired manner.

Usage

1
formatPval(x, break.eps = 1e-04, break.middle = 0.01, na.form = "NA", ...)

Arguments

x

a numeric vector.

break.eps

numeric value, see section details.

break.middle

numeric value, see section details.

na.form

character representation of NAs.

...

additional arguments passed to format.

Details

  • p-values < break.eps are written as: "< break.eps".

  • p-values >= break.eps but < break.middle have 1 digit.

  • p-values >= break.middle have 2 digits.

Value

A vector of length(x) with formatted p-values.

Author(s)

Sina Rueeger and Sebastian Meyer

See Also

the base function format.pval, format.pval in package Hmisc, formatPval in package reporttools, formatPval in package surveillance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
x <- c(1e-8, 0.00568, 0.0345, 0.885)
biostatUZH::formatPval(x)  # "< 0.0001" "0.006" "0.035" "0.89"

## compare to formatting of other packages
if (requireNamespace("reporttools")) {
    reporttools::formatPval(x) # "< 0.0001" "0.0057" "0.03" "0.88"
}
if (requireNamespace("Hmisc")) {
    Hmisc::format.pval(x)  # "0" "0.00568" "0.03450" "0.88500"
}
if (requireNamespace("surveillance")) {
    surveillance::formatPval(x)  # "<0.0001" "0.0057" "0.035" "0.89"
}

## adapt break.middle
biostatUZH::formatPval(x, break.middle = 0.001)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.