I have monthly column value in number
df <- data.frame(Month= c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3"))
I want to convert this to: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Jan, Feb, Mar
Can anyone help me with this please?
Thanking in advance for your time
month.abb[as.integer(df$Month)]
. Themonth.abb
is a base R constant. One unfortunate thing is that it is not locale-aware, so non-English months are not available via the same variable ... though it is rather easy to generate your own, since all it is is acharacter
vector, length 12. – r2evans