Converting Number month to month name

Hello All,

I am in need of your help.

I believe this is just a general question and doesnt require a dataset to assist in answering the question.

The question I have is:

"How do you convert number month into name month?"

My output in my column shows the months as 1-12 and I would prefer for it to show full or abbreviated name of the month.

I do all of my analysis using R Notebook.

All the help is greatly appreciated.

Thank you!


(rnum <- sample(1:12,size=6))[rnum][rnum]
1 Like


Thank you for the reply. I was wondering with the scenario I am facing, would I just use those lines of code you listed and pipe them into this?

What I did was take a birthday and separate them. My next step is to convert the number months to month name.

I tried various ways and keep getting an error.

Thank you so much for your help!

This is the line of code I used, just cant figure out how to add on the month name portion you shared.

separate(col = DOB, into = c("Month", "Day", "Year"), sep = "/")

Here is an example of one version.

#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>     filter, lag
#> The following objects are masked from 'package:base':
#>     intersect, setdiff, setequal, union

#invent data
Df <- data.frame(Date = c("1/3/2021", "2/5/2021"))

Df <- Df %>% separate(Date, into = c("Month", "Day", "Year"))
#>     Month               Day                Year          
#>  Length:2           Length:2           Length:2          
#>  Class :character   Class :character   Class :character  
#>  Mode  :character   Mode  :character   Mode  :character
Df <- Df %>% mutate(Month =[as.numeric(Month)])
#>   Month Day Year
#> 1   Jan   3 2021
#> 2   Feb   5 2021

Created on 2021-06-01 by the reprex package (v0.3.0)

Worked like a charm. Thank you so much!!!!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.