| pval_string {pixiedust} | R Documentation | 
Format P-values for Reports
Description
Convert numeric p-values to character strings according to pre-defined formatting parameters. Additional formats may be added for required or desired reporting standards.
Usage
pval_string(p, format = c("default", "exact", "scientific"), digits = 3, ...)
pvalString(p, format = c("default", "exact", "scientific"), digits = 3, ...)
Arguments
| p | a numeric vector of p-values. | 
| format | A character string indicating the desired format for the p-values. See Details for full descriptions. | 
| digits | For  | 
| ... | Additional arguments to be passed to  | 
Details
When format = "default", p-values are formatted:
-  p > 0.99: "> 0.99" 
-  0.99 > p > 0.10: Rounded to two digits 
-  0.10 > p > 0.001: Rounded to three digits 
-  0.001 > p: "< 0.001" 
When format = "exact", the exact p-value is printed with the 
number of places after the deimal equal to digits.  P-values smaller
that 1*(10^-digits) are printed in scientific notation.
When format = "scientific", all values are printed in scientific
notation with digits digits printed before the e.
Functional Requirements
- When - format = "default", print p-values greater than 0.99 as "> 0.99"; greater than 0.10 with two digits; greater than 0.001 with three digits; and less than 0.001 as "< 0.001".
- when - format = "exact", print the exact p-value out to at most- digitsplaces past the decimal place.
- When - format = "scientific", print the p-value in scientific notation with up to- digitsvalues ahead of the- e.
- Cast an error if - pis not numeric on the interval [0, 1]
- Cast an error if format is not one of - c("default", "exact", "scientific").
- Cast an error if - digitsis not- integerish(1).
Author(s)
Benjamin Nutter
Examples
 p <- c(1, .999, .905, .505, .205, .125, .09531,
        .05493, .04532, .011234, .0003431, .000000342)
 pvalString(p, format="default")
 pvalString(p, format="exact", digits=3)
 pvalString(p, format="exact", digits=2)
 pvalString(p, format="scientific", digits=3)
 pvalString(p, format="scientific", digits=4)