The R package toOrdinal contains a single function
toOrdinal
that converts a cardinal number (e.g., 9) into
its ordinal counterpart (e.g., 9th). Because such conversions are
language specific, the conversions are specific to a supported language.
At present, the package implements English, French, German, Spanish, and
Swedish. For example,
> toOrdinal(5)
[1] "5th"
> toOrdinal(5, language="German")
[1] "5te"
> toOrdinal(5, language="French")
[1] "5e"
> toOrdinal(5, language="Spanish")
[1] "5.º"
> toOrdinal(5, language="Swedish")
1] "5:e"
The toOrdinal Package is crafted with ❤️ by:
I love feedback and am happy to answer questions. Feel free to clone and make a pull request with the specifications for other languages.