[R] synchronisation of time series data using interpolation

Gabor Grothendieck ggrothendieck at gmail.com
Sat Sep 26 17:17:33 CEST 2009


On Sat, Sep 26, 2009 at 9:08 AM, e-letter <inpost at gmail.com> wrote:
> Test1 file contained data set 1, test2 contained data set 2
>



Its not clear to me what you are referring to. The data in your
initial post do not exhibit this problem and there is no data in any
of your subsequent posts in this thread.  Here is what happens when I
run it with your data -- no errors:

> Lines1 <- "time,datum
+ 01:00:00,500
+ 01:00:15,600
+ 01:00:30,750
+ 01:00:45,720
+ 01:01:00,700
+ 01:01:15,725
+ 01:01:30,640
+ 01:01:45,710"
>
> Lines2 <- "time,datum
+ 01:00:12,20
+ 01:01:01,55
+ 01:01:55,22"
>
> library(zoo)
> library(chron)
>
> z1 <- read.zoo(textConnection(Lines1), header = TRUE, sep = ",", FUN = times)
> z2 <- read.zoo(textConnection(Lines2), header = TRUE, sep = ",", FUN = times)
>
> z3 <- window(na.approx(merge(z1, z2)), time(z1))
> plot(z3$z1, z3$z2)
>




More information about the R-help mailing list