Split date into different columns for year, month and day

后端 未结 4 2051
醉话见心
醉话见心 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:41

    You can try:

    CET$year <- format(CET[,1], "%Y") # year
    CET$month <- format(CET[,1], "%m") # month
    CET$day <- format(CET[,1], "%d") # day
    

提交回复
热议问题