bcat_fmt_dollar: Label currencies

View source: R/bcat_fmts.R

bcat_fmt_dollarR Documentation

Label currencies

Description

A wrapper for scales::label_dollar to format a numeric vector to dollars and cents.

Usage

bcat_fmt_dollar(
  x,
  accuracy = NULL,
  scale = 1,
  largest_with_cents = 1e+05,
  style_negative = c("hyphen", "parens"),
  ...
)

Arguments

x

a numeric vector

accuracy

Number to round to. If NULL, the default, values will be rounded to the nearest integer

scale

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

largest_with_cents

largest numeric value for which cents will be displayed

style_negative

Character. How to display negative values: "hyphen" (default) or "parens".

...

other arguments passed on to label_dollar

Value

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

See Also

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

Examples


bcat_fmt_dollar(1:4)
bcat_fmt_dollar(c(-20, -10, 10, 20))
bcat_fmt_dollar(c(-20, -10, 10, 20), style_negative = "parens")

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