[R] seq POSIXct and fill in data by Tagmarie
Dagmar
Ramgad82 at gmx.net
Tue Oct 20 12:36:47 CEST 2015
Hello,
This must be a bloody R-beginner question but I just can't find an
answer in my beginner books:
I have a dataframe like this:
myframe <- data.frame (Timestamp=c("24.09.2012 09:00:00", "24.09.2012
10:00:00", "24.09.2012 11:00:00"), Event=c("0.1","0.5","1.2") )
myframe$Timestamp <- as.POSIXct(strptime(myframe$Timestamp,
format="%d.%m.%Y %H:%M:%S"))
expand<-data.frame(Timestamp=seq(myframe[1,1], myframe[3,1], by="1 mins"))
head(expand)
new <- merge(expand, myframe, all=T)
head(new)
I do not only want to expand the Dates but also I want to fill in the
"Events" (i.e. 0,1 untill the date were 0.5 starts).
How do I do this?
Thanks in advance!
More information about the R-help
mailing list