num2char | R Documentation |
Convert a number to its word equivalent.
num2char(x, informal = FALSE, cap = TRUE)
x |
an integer to convert to words; can be negative or positive but decimals will be rounded first |
informal |
logical; if |
cap |
logical; if |
Whole numbers twenty-one through ninety-nine are hyphenated when they are written out whether used alone or as part of a larger number; for example: "twenty-one" or "one million twenty-one."
Whole numbers in this range are not hyphenated for other orders of magnitude; for example, 52,052 is written "fifty two thousand fifty- two" and not "fifty-two thousand fifty-two." This rule applies only to two-word numbers 21-99.
Informal and formal case differ only by the use of "and" to separate 1-99: "one hundred one" is the formal case, and "one hundred and one" is the informal case.
http://dictionary.reference.com/help/faq/language/g80.html
https://www.grammarbook.com/numbers/numbers.asp
case
; adapted from
github.com/ateucher/useful_code/blob/master/R/numbers2words.r
num2char(52052, TRUE)
num2char(52052, FALSE)
## vectorized
num2char(-1:2)
x <- c(-1000, 100, 52052, 3922, 3012, 201, -152, 1002, 91070432)
cbind(x, informal = num2char(x, TRUE), formal = num2char(x, FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.