R-Help

 

I'm using the following code to deparate the date and time components from a
date_time varaible as follows:

 

dt1$date <- format(as.POSIXct(dt1$date_time, format = "%m/%d/%Y %H:%M"),
"%Y-%m-%d")

dt1$time <- format(as.POSIXct(dt1$date_time, format = "%m/%d/%Y %H:%M"),
"%H:%M:%S")

 

But I end up with <chr> objects. What am I missing?

 

Jeff


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to