Format P-values for Reports


Convert numeric p-values to character strings according to pre-defined formatting parameters. Additional formats may be added for required or desired reporting standards.



a numeric vector of p-values.


A character string indicating the desired format for the p-values. See Details for full descriptions.


For "exact" and "scientific"; indicates the number of digits to precede scientific notation.


Additional arguments to be passed to format


When format = "default", p-values are formatted:

  1. p > 0.99: "> 0.99"

  2. 0.99 > p > 0.10: Rounded to two digits

  3. 0.10 > p > 0.001: Rounded to three digits

  4. 0.001 > p: "< 0.001"

When format = "exact", the exact p-value is printed with the number of significant digits 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.

@author 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)

Want to suggest features or report bugs for Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus