I have a data frame containing date time information as characters in the format dd/mm/yyyy hh:mm but I can't get it to convert eg
$ LaserStart : chr "07/12/2014 11:21" "13/12/2014 05:37"
I am trying to convert them to date time using
data.LotCT$Start <- strptime(data.LotCT$LaserStart, "%d/%B/%Y %H:%M")
this runs without producing any errors but when I review the dataframe I have only NA
$ Start : POSIXlt, format: NA NA NA ...
thanks in advance
> x <- "07/12/2014 11:21"
> y <- strptime(x, format='%m/%d/%Y %H:%M')
> strftime(y, '%d/%B/%Y %H:%M')
[1] "12/July/2014 11:21"
Just figured it out
data.LotCT$Start <- strptime(data.LotCT$LaserStart, "%d/%B/%Y %H:%M")
should be
data.LotCT$Start <- strptime(data.LotCT$LaserStart, "%d/%m/%Y %H:%M")
which gives
$ Start : POSIXlt, format: "2014-12-07 11:21:00" "2014-12-13 05:37:00"
sorry for bothering you all :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.