| label-pt | R Documentation |
The label_xxx_pt family of functions makes it easy to format numbers in decimal format, as percentages or as currencies.
label_number_pt(
accuracy = 1,
scale = 1,
prefix = "",
suffix = "",
big.mark = NULL,
decimal.mark = NULL,
trim = TRUE,
...
)
label_percent_pt(
accuracy = 1,
scale = 100,
prefix = "",
suffix = NULL,
big.mark = NULL,
decimal.mark = NULL,
trim = TRUE,
...
)
label_currency_pt(
accuracy = 1,
scale = 1,
currency = "EUR",
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_pt formats numbers in decimal format.
label_percent_pt formats numbers as percentages.
label_currency_pt 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_pt()(c(-1e6, 0, 1e6))
label_percent_pt(accuracy = .01)(c(-1, 0, 1))
label_currency_pt(accuracy = .1)(c(-1e6, 0, 1e6))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.