[R] function approx interpolation of time series data sets

e-letter inpost at gmail.com
Fri Jan 18 13:31:12 CET 2013


On 16/01/2013, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> Like this?
>
>
> data1 <- read.table(text = "
> 01:23:40 5
> 01:23:45 10
> 01:23:50 12
> 01:23:55 7
> ")
>
> data2 <- read.table(text = "
> 01:23:42
> 01:23:47
> 01:23:51
> 01:23:54
> ")
>
> approx(as.POSIXct(data1$V1, format = "%H:%M:%S"), y = data1$V2, xout =
> as.POSIXct(data2$V1, format = "%H:%M:%S"))
>

Thanks. I have later realised that if data frames are unequal (i.e. data2edit

01:23:42
01:23:47
01:23:51
01:23:54
01:23:58
01:23:59

the result for 'y' is

$y
[1] NA NA NA NA NA NA

Similar error occurs with the 'zoo' package.

Is it better to do interpolation/further manipulation in another software tool?



More information about the R-help mailing list