pvalue: Rounding criterion for p-values

Description Usage Arguments Details Value See Also Examples

View source: R/statTools_code_OTHER.R

Description

Rounding significant p-values to the first non-zero decimal number and non-significant to two decimal places.

Usage

1
pvalue(pval, show.sig.stars = FALSE, alpha = 0.05)

Arguments

pval

Vector or matrix of p-values to be rounded.

show.sig.stars

Default to FALSE. TRUE for displaying stars, dots or nothing depending on the significance of the p-value.

alpha

Default to 0.05. Threshold for significance.

Details

P-values below 0.00001 are displayed as "<0.00001". This is the default function for rounding p-values. In case of confusion when the rounding returns exactly the value alpha, another decimal place is given. This can be changed in options("p.value.rounding"), with is a list where the first element is the name of the function as a string, and the other elements, the parameters to pass to this function.

Value

An object with the same class of pval, with all the p-values properly rounded and returned as strings.

See Also

bivarTable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pvalue(c(0.684736, 0.06543, 0.05146673, 0.05042, 0.049831, 0.04395, 
         0.0232, 0.0266, 0.0001235, 0.000000124527))
pvalue(c(0.684736, 0.06543, 0.05146673, 0.05042, 0.049831, 0.04395, 
         0.0232, 0.0066, 0.0001, 0.0001235, 0.000000124527), show.sig.stars = TRUE)
pvalue(c(0.684736, 0.16543, 0.10146673, 0.10042, 0.09949831, 0.0904395, 
         0.0910232, 0.090266, 0.04001235, 0.0002546, 0.000000124527), alpha = 0.1)
## Not run: 
# Use stars as a default option when calling pvalue() from another function such as bivarTable().
options("p.value.rounding" = list("pvalue", show.sig.stars = TRUE))

## End(Not run)

gcastella/statTools documentation built on May 16, 2019, 11:10 p.m.