numbers_to_words | R Documentation |
This can be helpful when writing reports with knitr/rmarkdown if
we want to print numbers as English words in the output. The function n2w()
is an alias of numbers_to_words()
.
numbers_to_words(x, cap = FALSE, hyphen = TRUE, and = FALSE)
n2w(x, cap = FALSE, hyphen = TRUE, and = FALSE)
x |
A numeric vector. The absolute values should be less than |
cap |
Whether to capitalize the first letter of the word. This can be
useful when the word is at the beginning of a sentence. Default is |
hyphen |
Whether to insert hyphen (-) when the number is between 21 and 99 (except 30, 40, etc.). |
and |
Whether to insert |
A character vector.
Daijiang Li
library(xfun)
n2w(0, cap = TRUE)
n2w(0:121, and = TRUE)
n2w(1e+06)
n2w(1e+11 + 12345678)
n2w(-987654321)
n2w(1e+15 - 1)
n2w(123.456)
n2w(123.45678901)
n2w(123.456789098765)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.