ordinal {english}R Documentation

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 class 'numeric'
ordinal(x, ...)
## S3 method for class 'english'
ordinal(x, ...)
## S3 method for class 'character'
ordinal(x, ...)

Arguments

x

An object to produce english ordinal output.

...

Additional arguments passed on to english for the initial conversion.

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.

Value

A character string vector of ordinal numbers in English.

Author(s)

Anthony Damico

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

## 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")

[Package english version 1.1-2 Index]