将月份的数字转换为月份的名称 [英] Convert month's number to Month name
本文介绍了将月份的数字转换为月份的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将包含一年中月份数的整数向量转换为月份的名称。
I need to convert this integer vector which contains the number of months in the year to month's name.
例如:
1
2
3
预期结果应为:
January
February
March
请问我该怎么做?
谢谢您的建议!
How can I do this, please? Thank you for your suggestions!
推荐答案
我们只能使用 month.name
将月份的索引更改为其相应的名称
We can just use month.name
to change the index of months to its corresponding name
month.name[v1]
,月份也有3个字符的缩写。
and there is also a 3 character abbreviation for month
month.abb[v1]
data
data
set.seed(24)
v1 <- sample(1:12, 24, replace = TRUE)
这篇关于将月份的数字转换为月份的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文