I need to convert this integer vector which contains the number of months in the year to month's name.
for example :
1
2
3
The expected result should be :
January
February
March
How can I do this, please? Thank you for your suggestions!
We can just use month.name
to change the index of months to its corresponding name
month.name[v1]
and there is also a 3 character abbreviation for month
month.abb[v1]
set.seed(24)
v1 <- sample(1:12, 24, replace = TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With