Description Usage Arguments Value Author(s) See Also Examples
Low level function for generating all other types of numeric labels.
The end-user should primarily use functions listed in
quantity_label
, whereas this function is intended for internal
use and special cases. If you find that you are
regularly using numeric_label
for a case not covered by the end-user
functions, please file an issue on GitHub for adding it.
1 2 |
x |
Numeric values. |
prefix |
A data frame containing prefix symbols and powers, see prefix. |
unit |
Unit symbol. |
unit_position |
Whether to put the unit before or after the numerical value. |
digits |
Number of significant digits, sent to |
space |
Whether to put a space between numeric value and unit. |
Character vector.
Christofer Bäcklin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Physical quantities
n <- 12
x <- 10^rnorm(n, sd = 6) * ifelse(runif(n) < .5, -1, 1)
data.frame(
x = x,
label = quantity_label(x, unit = "g")
)
# Currencies
x <- round(10^c(rgamma(n/2, 3, 1) - 2, rgamma(n/2, 5, 1)), digits = 2) * ifelse(runif(n) < .5, -1, 1)
data.frame(
x = x,
EUR = currency_label(x, prefix = TRUE, currency = "EUR"),
USD = currency_label(x, prefix = TRUE, currency = "USD"),
GBP = currency_label(x, prefix = TRUE, currency = "GBP"),
SEK = currency_label(x, prefix = TRUE, currency = "SEK")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.