> head(as.Date(data$日期,'%y%M%D'))
[1] NA NA NA NA NA NA

data日期格式如下:

R语言:as.Date出现NA值-LMLPHP

解决办法:

> head(as.Date(data$日期,'%y%m%d'))
[1] "2017-06-01" "2017-06-01" "2017-06-01" "2017-06-01" "2017-06-01" "2017-06-01"

format的大写全部改成小写即可解决

05-11 22:43