| ordinal {english} | R Documentation |
The function ordinal is generic and works in much
the same way as the function as.character.english but
produces an ordinal, rather than a cardinal number version
ordinal(x, ...) ## S3 method for class 'numeric' ordinal(x, ...) ## S3 method for class 'english' ordinal(x, ...) ## S3 method for class 'character' ordinal(x, ...)
x |
An object to produce english ordinal output. |
... |
Additional arguments passed on to |
The object is first converted to a character string an english
object, if necessary, then to character and finally adjusted so that
it provides the ordinal version of the english representation.
A character string vector of ordinal numbers in English.
Anthony Damico
See original note by John Fox in the Programmers Niche section of https://cran.r-project.org/doc/Rnews/Rnews_2005-1.pdf.
## for UK style English:
ordinal(c(1, 9, 10, 11, 12, 19, 20, 21, 99, 100, 101, 109, 111,
119, 1000, 1100, 1199, 9999, 10000, 10001), UK = TRUE)
## for USA style English:
ordinal(c(1, 9, 10, 11, 12, 19, 20, 21, 99, 100, 101, 109, 111,
119, 1000, 1100, 1199, 9999, 10000, 10001), UK = FALSE)
## For mothers of small children:
cat(paste("This is the", ordinal(1:5), "time I've told you!"), sep = "\n")