| label-locale | R Documentation |
The label_xxx_locale family of functions makes it easy to format numbers in decimal format, as percentages or as currencies.
label_number_locale(
accuracy = NULL,
scale = 1,
prefix = "",
suffix = "",
big.mark = NULL,
decimal.mark = NULL,
locale = "en-US",
trim = TRUE,
...
)
label_percent_locale(
accuracy = NULL,
scale = 100,
prefix = NULL,
suffix = NULL,
big.mark = NULL,
decimal.mark = NULL,
locale = "en-US",
trim = TRUE,
...
)
label_currency_locale(
accuracy = NULL,
scale = 1,
prefix = NULL,
suffix = NULL,
big.mark = NULL,
decimal.mark = NULL,
p_sep_by = NULL,
n_sep_by = NULL,
currency = "USD",
locale = "en-US",
trim = TRUE,
...
)
accuracy |
A number to round to. Use (e.g.) Applied to rescaled data. |
scale |
A scaling factor: |
prefix |
Additional text to display before the number. The suffix is
applied to absolute value before |
suffix |
Additional text to display after the number. |
big.mark |
Character used between every 3 digits to separate thousands.
The default ( |
decimal.mark |
The character to be used to indicate the numeric
decimal point. The default ( |
locale |
locale string. Defaults to "en-US" |
trim |
Logical, if |
... |
Other arguments passed on to |
p_sep_by |
separator between currency symbol and positive monetary value |
n_sep_by |
separator between currency symbol and negative monetary value |
currency |
currency symbol |
label_number_locale formats numbers in decimal format.
label_percent_locale formats numbers as percentages.
label_currency_locale formats numbers as currencies.
A labelling function that takes a numeric vector and returns a character vector.
# rendered directly (rather than via scales::demo_continuous()) because
# several locales' group/currency signs aren't in the check device's font
label_number_locale(locale = "fr-FR")(c(-1e6, 0, 1e6))
label_percent_locale(locale = "it-IT", accuracy = .01)(c(-1, 0, 1))
label_currency_locale(
locale = "ja-JP", accuracy = .1,
currency = "JPY"
)(c(-1e4, 0, 1e4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.