bcat_fmt_percent: Label percentages

View source: R/bcat_fmts.R

bcat_fmt_percentR Documentation

Label percentages

Description

A wrapper for scales::label_percent to format a numeric vector to percentages.

Usage

bcat_fmt_percent(x, accuracy = NULL, scale = 100, ...)

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.

scale

A scaling factor: x will be multiplied by scale before formatting.

...

other arguments passed to label_percent

Value

A character vector of formatted percentage labels with the same length as x.

See Also

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

Examples


bcat_fmt_percent(c(0.01, 0.05, 0.02))
bcat_fmt_percent(c(0.0151321, 0.090115, 0.022141))
bcat_fmt_percent(c(0.0151321, 0.090115, 0.022141), accuracy = 0.001)
bcat_fmt_percent(c(1.31, 2.44, 3.0), scale = 1)

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