从数字创建字符串

时间:2015-07-28 17:59:33

标签: r

如何制作数字的单词形式?我有数字并想知道如何将它们转换为字符串?

1 to 1st
2 to 2nd
3 to 3rd
.
.
11 to 11th
.
21 to 21st
etc

1 个答案:

答案 0 :(得分:5)

来自?ordinal_format

中的示例scales
library(scales)
ordinal_format()(1:10)
# [1] "1st"  "2nd"  "3rd"  "4th"  "5th"  "6th"  "7th"  "8th"  "9th"  "10th"