num_currency: Numeric vector with currency format

View source: R/num_currency.R

num_currencyR Documentation

Numeric vector with currency format

Description

Formats numbers with a thousand separator and a currency indicator.

Usage

num_currency(
  x,
  symbol = "$",
  digits = 2L,
  format = "f",
  big.mark = ",",
  ...,
  sep = ""
)

parse_currency(
  x,
  symbol = get_currency_symbol(x),
  digits = max(get_digits(x)),
  format = "f",
  big.mark = ",",
  ...
)

Arguments

x

a numeric vector.

symbol

currency symbol

digits

an integer to indicate the number of digits of the percentage string.

format

format type passed to formatC().

big.mark

thousands separator

...

additional parameters passed to formattable().

sep

separator between symbol and value

See Also

Other numeric vectors: num_accounting(), num_comma(), num_digits(), num_percent(), num_scientific()

Examples

num_currency(200000)
num_currency(200000, "\U20AC")
num_currency(1200000, "USD", sep = " ")
num_currency(1200000, "USD", format = "d", sep = " ")
parse_currency("$ 120,250.50")
parse_currency("HK$ 120,250.50", symbol = "HK$")
parse_currency("HK$ 120, 250.50")

renkun-ken/formattable documentation built on Dec. 7, 2024, 10:19 p.m.