Description Usage Arguments Value Examples
Formats p-values for tables generated by the functions in the tab package. Handles rounding and presentation of p-values.
1 2 3 4 5 6 7 8 |
p |
Numeric vector of p-values. |
decimals |
Number of decimal places for p-values. If a vector is
provided rather than a single value, number of decimal places will depend on
what range the p-value lies in. See |
cuts |
Cut-point(s) to control number of decimal places used for
p-values. For example, by default |
lowerbound |
Controls cut-point at which p-values are no longer printed
as their value, but rather <lowerbound. For example, by default
|
leading0 |
If |
avoid1 |
If |
Character vector.
1 2 3 4 5 6 7 8 9 | # Generate vector of numeric p-values
set.seed(123)
p <- c(runif(n = 5, min = 0, max = 1), 1, 0, 4e-7, 0.009)
# Round to nearest 2 decimals for p in (0.01, 1] and 3 decimals for p < 0.01
pvals <- formatp(p = p)
# Use 2 decimal places, a lower bound of 0.01, and omit the leading 0
pvals <- formatp(p = p, decimals = 2, lowerbound = 0.01, leading0 = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.