I have a data set which has the date time column but the format is muddled up and whats difficult is that the column also has NA
values
date_time <- c("11/7/2016 14:11", "12-11-2016 2:00:54", "NA", "12/7/2016 22:03")
I need the NA
values to be ignored, the seconds to be inserted and date format to be unified.
Using gsub(pattern ='-', replacement='/', date_test)
i am able to fix the date format
When I apply any date time format using as.Date
or as.POSIX
, it results in NA
values as some time is without seconds. The table already has NA
values so I lose values.
I need to either round up time to minutes or insert dummy seconds before formatting it as date time it gives me NA
values
Thanks