I'm trying to figure out how to merge two time series with different frequencies.The first time series are on 1 minute interval
time1<-seq(from=as.POSIXct("2010-03-01 13:02"),to=as.POSIXct("2010-03-01 13:10"),by="1 min")
value<-round(matrix(runif(90,1,10),9,10),2)
data<-data.frame(time1,value)
data
time1 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
1 2010-03-01 13:02:00 2.03 9.06 6.93 8.78 1.62 6.79 7.30 8.58 7.17 5.71
2 2010-03-01 13:03:00 6.68 6.36 1.32 1.32 7.40 6.46 5.86 9.22 7.48 2.56
3 2010-03-01 13:04:00 2.68 1.26 7.54 9.32 2.20 5.83 2.58 2.33 9.13 6.77
4 2010-03-01 13:05:00 9.82 9.78 2.73 6.68 8.59 8.18 4.59 3.84 6.65 9.28
5 2010-03-01 13:06:00 9.47 5.97 5.18 7.32 2.66 2.62 9.14 2.81 1.60 3.29
6 2010-03-01 13:07:00 9.11 4.92 2.03 3.10 3.77 9.96 7.30 8.19 6.06 6.32
7 2010-03-01 13:08:00 4.46 1.42 9.97 8.96 7.16 2.21 1.72 9.08 3.45 6.27
8 2010-03-01 13:09:00 7.43 8.99 9.47 5.66 1.43 4.34 9.94 7.62 1.34 8.55
9 2010-03-01 13:10:00 6.10 2.09 6.47 3.83 7.05 9.65 4.84 1.34 6.14 6.63
The second time series are on 5 min interval
time2<-seq(from=as.POSIXct("2010-03-01 13:00"),to=as.POSIXct("2010-03-01 13:10"),by="5 min")
value2<-round(matrix(runif(6,1,10),3,2),2)
data2<-data.frame(time2,value2)
data2
time2 X1 X2
1 2010-03-01 13:00:00 4.55 3.93
2 2010-03-01 13:05:00 4.05 8.04
3 2010-03-01 13:10:00 6.87 7.93
The preferred output would combine the two time series on the 5 minute interval so I would have a new data frame:
1 2010-03-01 13:05:00 4.05 8.04 9.82 9.78 2.73 6.68 8.59 8.18 4.59 3.84 6.65 9.28
2 2010-03-01 13:10:00 6.87 7.93 6.10 2.09 6.47 3.83 7.05 9.65 4.84 1.34 6.14 6.63
For sure there is simple function for this but I'm unable to find it.