Description Usage Arguments Examples
a formatter that lets you take numeric or integer values (12000) and convert them to strings that are currency-formatted ($12,000). Full control is available over the currency symbol, the size of delimited groups, the sign used to delimit groups, and decimal placement.
1 2 3 | to_currency(x, currency_symbol = "£", symbol_first = TRUE,
group_size = 3, group_delim = ",", decimal_size = 2,
decimal_delim = ".")
|
x |
a numeric or integer vector containing values you want to currency-ify |
currency_symbol |
the symbol that identifies the currency. "£" by default. |
symbol_first |
whether the symbol goes at the beginning (TRUE) or end (FALSE) of the generated value. TRUE by default. |
group_size |
the size of delimited groups (2, 3, or 4 digits, say). Set to 3 by default. |
group_delim |
the delimiter for each group. |
decimal_size |
the number of digits after the decimal place. 2 by default but can be more (the Japanese Yen, for example, can go down to one rin, which is a thousandth of a Yen). |
decimal_delim |
the delimiter to use for sub-unit, decimal values. A period by default. |
1 2 | to_currency(120000.03)
#[1] "£120,000.03"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.