toOrdinal( cardinal_number, language="English", convert_to="ordinal_number")
cardinal_number | Postive integer (cardinal number) to be converted to an ordinal number. For example 1 becomes 1st, 2 becomes 2nd, ... |
---|---|
language | OPTIONAL. Language (defaults to English) indicating what language rules to use in conversion to ordinal number. |
convert_to | OPTIONAL. Output type that provided 'cardinal_number' is converted into. Default is 'ordinal_number' which refers to the 'cardinal_number' followed by the appropriate ordinal indicator. Additional options planned include 'ordinal_word'. |
Typical use of the function is to submit a positive integer for conversion to an ordinal number in the language specified. See examples.
Function returns the ordinal number or ordinal word (as a character string).
toOrdinal(1) ## 1st#> [1] "1st"toOrdinal(1, language="French") ## 1re#> [1] "1re"toOrdinal(1:20) ## 1st, 2nd, 3rd, ...#> [1] "1st" "2nd" "3rd" "4th" "5th" "6th" "7th" "8th" "9th" "10th" #> [11] "11th" "12th" "13th" "14th" "15th" "16th" "17th" "18th" "19th" "20th"toOrdinal(1:25, language="French") ## 1re, 2e, 3e, ...#> [1] "1re" "2e" "3e" "4e" "5e" "6e" "7e" "8e" "9e" "10e" "11e" "12e" #> [13] "13e" "14e" "15e" "16e" "17e" "18e" "19e" "20e" "21e" "22e" "23e" "24e" #> [25] "25e"