All functions in this package are deprecated. Please use the
{cocoon}
package instead.
format_p()
inputs numeric vectors of p-values. Cutoffs can be set that
format the values as less than the cutoffs (e.g., p < 0.001). The default
output is APA formatted, but numbers of digits, cutoffs, leading zeros, and
italics are all customizable.
Arguments
- x
Number representing p-value
- digits
Number of digits after the decimal for p-values, ranging between 1-5 (also controls cutoff for small p-values)
- pzero
Logical indicator of whether to include leading zero for p-values
- label
Character string for label before p value. Default is p. Set
label = ""
to return just the formatted p value with no label or operator (=
,<
,>
)- italics
Logical for whether label should be italicized (p)
- type
Type of formatting ("md" = markdown, "latex" = LaTeX)
Value
A character string that includes p and then the p-value formatted in
Markdown or LaTeX. If p-value is below digits
cutoff, p < cutoff
is
used.
Examples
format_p(0.001)
#> [1] "_p_ = .001"
# Round digits for p-values greater than cutoff
format_p(0.111, digits = 2)
#> [1] "_p_ = .11"
# Default cutoff is p < 0.001
format_p(0.0001)
#> [1] "_p_ < .001"
# Set cutoff with digits
format_p(0.0001, digits = 2)
#> [1] "_p_ < .01"
# Include leading zero
format_p(0.001, pzero = TRUE)
#> [1] "_p_ = 0.001"
# Return only Bayes factor value (no label)
format_p(0.001, label = "")
#> [1] ".001"