Split date into different columns for year, month and day

后端 未结 4 2052
醉话见心
醉话见心 2020-11-27 21:21

I have zoo objects that look like:

head(obs)

      Index pp
1932-01-01  0
1932-01-02  0.2
1932-01-03  0

and I want to split the ind

4条回答
  •  星月不相逢
    2020-11-27 21:52

    require(lubridate)
    maindata1 <- cbind(maindata1, day=day(maindata1$Date), month=month(maindata1$date), year=year(maindata1$date))
    

提交回复
热议问题