| format_p | R Documentation | 
Create rounded, character versions of p-values for presentation
format_p(p, min_digits = 2, max_digits = 3, level = 0.05, write_p = TRUE)
p | 
 A numeric vector of p-values to be formatted  | 
min_digits | 
 The minimum number of digits to display  | 
max_digits | 
 The maximum number of digits to display for a small p-value  | 
level | 
 Significance level tested at  | 
write_p | 
 If   | 
The goal of this function is to round P values for tables or text.
If rounding a p value to min_digits is not 0, 1, or the significance level, that is returned.
Values rounded to 1 or the significance level will be iteratively rounded to another digit until a distinct value is returned.
Values near zero will be iteratively rounded until reaching a nonzero value or reaching max_digits.
Remaining values are labeled as 'P < 0.00...1'
An atomic character vector
Sven Halvorson
p_vals = c(0.6963, 0.00007, 0.0247, 0.0253, 0.999964)
format_p(
  p = p_vals,
  min_digits = 3,
  max_digits = 4,
  level = 0.025
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.