[R] separate date and time

Schatzi adele_thompson at cargill.com
Thu May 12 15:57:03 CEST 2011


I have a combined date and time. I would like to separate them out into two
columns so I can do things such as take the mean by time across all dates.

meas<-runif(435)
nTime<-seq(1303975800, 1304757000, 1800)
nDateT<-as.POSIXct(nTime, origin="1970-01-01")
mat1<-cbind(nDateT,meas)

means1<- aggregate(mat1$meas, list(nDateT), mean)

This doesn't do anything as each day is different, but if I had just the
time, it would take the mean outputing 48 values (for each 30 min).

Also, sometimes there are missing meas to a specific time. Is there anyway
to copy the previous meas if one is missing?

-----
In theory, practice and theory are the same. In practice, they are not - Albert Einstein
--
View this message in context: http://r.789695.n4.nabble.com/separate-date-and-time-tp3517571p3517571.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list