num_order_to_word | R Documentation |
Converts a vector of numbers to a character string approximation using the "short scale" version of large number names. e.g. 312e6 returns as '300 million.' Simultaneously returns a numeric representation of the approximation.
num_order_to_word(x, lookup = NULL, nsmall = 0)
x |
A vector of numbers to convert. |
lookup |
Optional. A data frame specifying numeric exponents as 'expon' and corresponding names as 'word'. e.g. lookup = data.frame(expon = c(3, 0, -3), word = c("thousands", "", "thousandths")) |
nsmall |
Optional. An integer number of digits to include to the right of the the leading digit |
A data frame containing the originally-supplied vector, the short scale version, and its string representation
# Simplest example num_order_to_word(1340) # Using a variable x <- exp(1)^20 num_order_to_word(x) num_order_to_word(x, nsmall = 1) x <- exp(1)^-10 num_order_to_word(x) ## Not run: x <- 1:4 num_order_to_word(x) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.