in R with Example

The is an inbuilt R constant. in R

The is the English name for the months of the year. Sometimes date vector for months is recorded in numeric form, and it becomes difficult to treat or visualize it as a date vector.

For example, if the vector for months has numbers 1 that represents January, 2 that represents February, and so on, then it is considered as a numeric vector instead of the vector to represent the month.



[1] "January" "February" "March"     "April"   "May"      "June"
[7] "July"    "August"   "September" "October" "November" "December"

Changing Month Names to numerical month values

If you have a vector of integers consisting of the number of the month, then you can use it to get the Month Names by doing the following.

mnth <- c(11, 9, 4, 2)[mnth]


[1] "November" "September" "April" "February"

That is it for the constant.

See also


letters in R

pi in R

Leave a Comment