Formats numbers with a thousand separator and a currency indicator.
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 = ",",
...
)
a numeric vector.
currency symbol
an integer to indicate the number of digits of the percentage string.
format type passed to formatC()
.
thousands separator
additional parameters passed to formattable()
.
separator between symbol and value
Other numeric vectors:
num_accounting()
,
num_comma()
,
num_digits()
,
num_percent()
,
num_scientific()
num_currency(200000)
#> [1] $200,000.00
num_currency(200000, "\U20AC")
#> [1] €200,000.00
num_currency(1200000, "USD", sep = " ")
#> [1] USD 1,200,000.00
num_currency(1200000, "USD", format = "d", sep = " ")
#> [1] USD 1,200,000
parse_currency("$ 120,250.50")
#> [1] $120,250.50
parse_currency("HK$ 120,250.50", symbol = "HK$")
#> [1] HK$120,250.50
parse_currency("HK$ 120, 250.50")
#> [1] HK$120,250.50