| english-package {english} | R Documentation |
A simple facility to provide an english language representation of integer vectors.
| Package: | english |
| Type: | Package |
| Version: | 1.1-4 |
| Date: | 2018-08-07 |
| License: | GPL-2 |
| LazyLoad: | yes |
In answer to a question on R-help John Fox provided an elegant R function to translate integers into English numbers. The present package extends this code to an S3 class, with constructor functions and methods to make this original idea more conveniently available.
The function as.english is intended to provide a parallel
facility to the function as.roman in the utils package.
The main purpose of the package is to present an interesting programming example rather than to solve a likely real problem, though there could well be some applications in unusual contexts.
Note added on Version 1.1-4. The two small helper functions words
and Words are included to facilitate inline code inserts in
R markdown files. See the help files for examples. The ordinal
function produces character strings and may be used directly in inline
code inserts. Use `r words(10000)` rather than `r english(10000)`
in R markdown files.
John Fox and Bill Venables with additional ideas and code from Anthony Damico.
Maintainer: Bill Venables, <Bill.Venables@gmail.com>
See original note by John Fox in the Programmers Niche section of https://cran.r-project.org/doc/Rnews/Rnews_2005-1.pdf.
english(1:10)^2 + 1:10
(x <- english(sample(1:100, 10)))
sort(x)
toupper(english(1:10))
## For mothers of small children:
cat(paste("This is the", ordinal(1:5), "time I've told you!"), sep = "\n")