I want to calculate length in different time dimensions but I have problems dealing with the two slightly different time formats in my data frame column.
The origin
or you can also use:
time<- c("2018-07-29T15:02:05Z", "2018-07-29T14:46:57Z", "2018-10-04T12:13:41.333Z", "2018-10-04T12:13:45.479Z") length<-c(15.8,132.1,12.5,33.2) df<-data.frame(time,length) library(lubridate) # df$time2<-as_datetime(df$time) df$time2 <-parse_date_time(df$time, "ymd_HMS") df