Convert numeric date format (YYYYMMDD; 20150101) into Year-Month

前端 未结 3 2015
你的背包
你的背包 2021-01-20 02:37

Can anyone of you help in converting the date from 20150101 to abbreviated form Jan-2015 ?

I tried the below method.

x = 20         


        
3条回答
  •  青春惊慌失措
    2021-01-20 03:22

    Using lubridate and zoo packages:

    library(lubridate)
    library(zoo)
    
    x <- "20150101"
    
    as.yearmon(as.Date(ymd(x)))
    
    [1] "jan 2015"
    

提交回复
热议问题