Title: | Cardinal to Ordinal Number & Date Conversion |
---|---|
Description: | Language specific cardinal to ordinal number conversion. |
Authors: | Damian W. Betebenner [aut, cre], Andrew Martin [ctb], Jeff Erickson [ctb] |
Maintainer: | Damian W. Betebenner <[email protected]> |
License: | GPL-3 |
Version: | 1.3-9.1 |
Built: | 2025-03-09 02:40:22 UTC |
Source: | https://github.com/centerforassessment/toordinal |
Language specific cardinal to ordinal number conversion.
Package: | toOrdinal |
Type: | Package |
Version: | 1.3-9.1 |
Date: | 2024-12-3 |
License: | GPL-3 |
LazyLoad: | yes |
Damian W. Betebenner [email protected]
Function for converting cardinal to ordinal numbers by adding a language specific ordinal indicator (http://en.wikipedia.org/wiki/Ordinal_indicator) to the number.
toOrdinal( cardinal_number, language="English", convert_to="ordinal_number")
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).
Damian W. Betebenner [email protected]
toOrdinal(1) ## 1st toOrdinal(1, language="French") ## 1re toOrdinal(1:20) ## 1st, 2nd, 3rd, ... toOrdinal(1:25, language="French") ## 1re, 2e, 3e, ...
toOrdinal(1) ## 1st toOrdinal(1, language="French") ## 1re toOrdinal(1:20) ## 1st, 2nd, 3rd, ... toOrdinal(1:25, language="French") ## 1re, 2e, 3e, ...
Function for converting a calendar date to it long, ordinal version.
toOrdinalDate( date=NULL, language="English")
toOrdinalDate( date=NULL, language="English")
date |
Either NULL (the default which uses the current date returned via |
language |
OPTIONAL. Language (defaults to English) indicating what language rules to use in conversion to ordinal number. |
Typical use of the function is to call the function with any argument to get the current date in long, ordinal form. See examples.
Function returns the character string with the long, ordinal calendar date.
Damian W. Betebenner [email protected]
toOrdinalDate() toOrdinalDate("2017-10-9") ## October 9th, 2017 toOrdinalDate("2017-10-09") ## October 9th, 2017 toOrdinalDate(c("2022-11-21", "2019-1-3", "1976-2-2", "1965-2-18")) ## "November 21st, 2022" "January 3rd, 2019" "February 2nd, 1976" "February 18th, 1965"
toOrdinalDate() toOrdinalDate("2017-10-9") ## October 9th, 2017 toOrdinalDate("2017-10-09") ## October 9th, 2017 toOrdinalDate(c("2022-11-21", "2019-1-3", "1976-2-2", "1965-2-18")) ## "November 21st, 2022" "January 3rd, 2019" "February 2nd, 1976" "February 18th, 1965"