num2char | R Documentation |
Convert whole or decimal numbers to word equivalent. N2W
is
equivalent to n2w
/num2char
but defaults to capitalizing
the first word.
num2char(x, cap = FALSE, informal = FALSE, hyphen = TRUE, and = FALSE)
n2w(x, cap = FALSE, informal = FALSE, hyphen = TRUE, and = FALSE)
N2W(x, cap = TRUE, informal = FALSE, hyphen = TRUE, and = FALSE)
x |
numeric vector, less than '1e15' |
cap |
logical; if |
informal , and |
logical; insert "and" between hundreds and tens |
hyphen |
logical; insert hyphen when the number is between 21 and 99 (except 30, 40, etc) |
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."
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 xfun::numbers_to_words
n2w(1e15 - 1)
n2w(0:121, and = TRUE)
n2w(123.456)
N2W(1e6)
x <- c(-1000, 100, 52052, 3922, 3012, 201, -152, 1002, 91070432)
cbind(x, informal = num2char(x, informal = TRUE), formal = num2char(x, FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.