R
now there is a copy of data similar to yyyy-mm-dd hh:mm:ss format stored in the second column of Data.csv
< hr >DateTimes <- Data[2]
>DateTimes
1 2017-01-01 00:00:00
2 2017-01-01 00:00:02
3 2017-01-01 00:00:02
4 2017-01-01 00:00:03
5 2017-01-01 00:00:05
.
want to convert to time in the following way, but always report an error
mydate <- as.POSIXlt(Data[2])
error report:
"Data[2]""POSIXlt"
in the same case, there is no problem if you use it directly
mydate <- as.POSIXlt("2017-01-01 00:00:01" )
> mydate
[1] "2017-01-01 00:00:05 CST"
excuse me, what"s going on? How should it be solved?