format_pval | R Documentation |
This function was designed with formatting p-values, but it can be used to format any double to a desired number of decimal places, returning it as a character vector.
format_pval(p, digits = 3, zero = FALSE)
p |
One or more p-values as either a numeric vector or numeric variable in a data frame. |
digits |
How many digits to round to? Defaults to 3. |
zero |
Include 0 before decimal point? Default is FALSE |
A character vector of rounded p-values. Any p-values less than .001 are shown as "< .001"
p.value <- c(.01, .005, .00024)
format_pval(p.value)
format_pval(p.value, zero = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.