R change integer to three integers

前端 未结 3 1811
闹比i
闹比i 2021-01-23 01:35

I have this number

20101213 which is a representation of this data 2010 Dec 13th I want to extract the year, month and day numbers from that nu

3条回答
  •  旧巷少年郎
    2021-01-23 02:12

    year <- as.numeric(substr(as.character(value),start = 1,stop = 4))
    month <- as.numeric(substr(as.character(value),start = 5,stop = 6))
    day <- as.numeric(substr(as.character(value),start = 7,stop = 8))
    

提交回复
热议问题