| label-us | R Documentation |
The label_xxx_xxx family of functions makes it easy to format numbers in decimal format, as percentages or as currencies.
label_number_us(
accuracy = 1,
scale = 1,
prefix = "",
suffix = "",
big.mark = NULL,
decimal.mark = NULL,
trim = TRUE,
...
)
label_percent_us(
accuracy = 1,
scale = 100,
prefix = NULL,
suffix = NULL,
big.mark = NULL,
decimal.mark = NULL,
trim = TRUE,
...
)
label_currency_us(
accuracy = 1,
scale = 1,
currency = "USD",
prefix = NULL,
suffix = NULL,
big.mark = NULL,
decimal.mark = NULL,
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 ( |
trim |
Logical, if |
... |
Other arguments passed on to |
currency |
currency symbol |
label_number_us formats numbers in decimal format.
label_percent_us formats numbers as percentages.
label_currency_us formats numbers as currencies.
A labelling function that takes a numeric vector and returns a character vector.
require(scales)
demo_continuous(c(-1e6, 1e6),
labels = label_number_us()
)
demo_continuous(c(-1, 1),
labels = label_percent_us(accuracy = .1)
)
demo_continuous(c(-1, 1),
labels = label_currency_us(accuracy = .1)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.