I am struggling while trying to convert a column of type char to datetime.
Date.Time Lat Lon Base
<chr> <dbl> <dbl> <chr>
4/1/2014 0:11:00 40.7690 -73.9549 B02512
4/1/2014 0:17:00 40.7267 -74.0345 B02512
4/1/2014 0:21:00 40.7316 -73.9873 B02512
⋮ ⋮ ⋮ ⋮
4/30/2014 23:31:00 40.7443 -73.9889 B02764
4/30/2014 23:32:00 40.6756 -73.9405 B02764
4/30/2014 23:48:00 40.6880 -73.9608 B02764
Using mutate:
df <- mutate(df, Date.Time = as.POSIXct(Date.Time,
format = "%M/%D%/%Y% %H:%M%S"))
While the type for Date.Time has changed from to , the whole column is just NAs.
Output of Sys.getlocale():
'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=C;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C'