Numeric vector with currency format
currency(x, symbol, digits, format = "f", big.mark = ",", ...)
# Default S3 method
currency(
x,
symbol = "$",
digits = 2L,
format = "f",
big.mark = ",",
...,
sep = ""
)
# S3 method for class 'character'
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
currency(200000)
#> [1] $200,000.00
currency(200000, "\U20AC")
#> [1] €200,000.00
currency(1200000, "USD", sep = " ")
#> [1] USD 1,200,000.00
currency(1200000, "USD", format = "d", sep = " ")
#> [1] USD 1,200,000
currency("$ 120,250.50")
#> [1] $120,250.50
currency("HK$ 120,250.50", symbol = "HK$")
#> [1] HK$120,250.50
currency("HK$ 120, 250.50")
#> [1] HK$120,250.50