How about something like:

> data$DateTime<- strptime(paste(data$day.hour,data$min.sec,sep=" 
> "),format="%j%H %M%S")
> data$Date <- strftime(data$DateTime,format="%Y-%m-%d")
> data$Time <- strftime(data$DateTime,format="%H:%M:%S")
> data
  day.hour min.sec            DateTime       Date     Time
1    12517    2034 2011-05-05 17:20:34 2011-05-05 17:20:34
2    12520    2004 2011-05-05 20:20:04 2011-05-05 20:20:04
3    12507    2045 2011-05-05 07:20:45 2011-05-05 07:20:45
4    12502    2000 2011-05-05 02:20:00 2011-05-05 02:20:00
5    12500    2004 2011-05-05 00:20:04 2011-05-05 00:20:04

______________________________________________
R-help@r-project.org mailing list
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