bcat_fmt_pvalue: Label p-values

View source: R/bcat_fmts.R

bcat_fmt_pvalueR Documentation

Label p-values

Description

A wrapper for scales::label_pvalue to format a numeric vector to p-values, using "<" and ">" for p-values close to 0 and 1.

Usage

bcat_fmt_pvalue(x, accuracy = 0.001, add_p = FALSE, ...)

Arguments

x

a numeric vector

accuracy

A number to round to. Use (e.g.) 0.01 to show 2 decimal places of precision. If NULL, the default, uses a heuristic that should ensure breaks have the minimum number of digits needed to show the difference between adjacent values.

add_p

logical. Add "p=" before the value?

...

other arguments passed to label_pvalue

Value

A character vector of formatted p-value labels with the same length as x.

See Also

Other formatting: bcat_fmt_comma(), bcat_fmt_date(), bcat_fmt_dollar(), bcat_fmt_percent(), bcat_fmt_scientific()

Examples


bcat_fmt_pvalue(c(0.01, 0.05, 0.02))
bcat_fmt_pvalue(c(0.000001, 0.999115, 0.022141))
bcat_fmt_pvalue(c(0.000001, 0.999115, 0.022141), add_p = TRUE)

Rbearcat documentation built on March 21, 2026, 5:07 p.m.