| as.english {english} | R Documentation |
The functions as.english and english are fully
equivalent generic constructor functions for the S3 class
english, which allows numeric objects to be represented in
the form of their customary English expression.
as.english(x, ...) english(x, ...) ## Default S3 method: english(x, ...) ## S3 method for class 'numeric' english(x, UK, ...) ## S3 method for class 'english' english(x, UK, ...) ## S3 method for class 'english' x[i] ## S3 method for class 'english' rep(x, ...) ## S3 method for class 'english' format(x, ...)
x |
Any numeric object. If the components are not integers, they are
rounded. In the case of |
UK |
A logical flag, should English-style numbers be given ( |
... |
For |
i |
Any allowable form of index vector. |
The function english is a generic constructor function for
objects of class english. The methods either mark the object
as having the appropriate class, or, in the case of
english.default, result in an error message. The function
as.english is provided as a corresponding function to
as.roman in the utils package. The method
english.english simply allows the constructor function to act
as a coercion and to have no effect on objects already of the class.
An object of class english, if possible, or an error message if
not.
John Fox and Bill Venables
See original note by John Fox in the Programmers Niche section of https://cran.r-project.org/doc/Rnews/Rnews_2005-1.pdf.
as.character.english, print.english.
english(1010, UK = FALSE)
english(1010, UK = TRUE)
## The default UK setting will depend on the locale:
cat("\n", ifelse(grepl("^(en_us|english_united)",
tolower(Sys.getlocale("LC_CTYPE"))), "USA", "UK"),
"English is your default\n")
english(101) ## UK not given: deduced from locale
as.english(10001001) + (-5):5