english (version 1.1-3)

ordinal: Generic functions and methods generating english versions of ordinal whole numbers as character strings

Description

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

Usage

ordinal(x, ...)
# S3 method for numeric
ordinal(x, ...)
# S3 method for english
ordinal(x, ...)
# S3 method for character
ordinal(x, ...)

Arguments

x

An object to produce english ordinal output.

Additional arguments passed on to english for the initial conversion.

Value

A character string vector of ordinal numbers in English.

Details

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.

References

See original note by John Fox in the Programmers Niche section of https://cran.r-project.org/doc/Rnews/Rnews_2005-1.pdf.

See Also

as.character.english

Examples

Run this code
# NOT RUN {
## 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")
# }

Run the code above in your browser using DataLab