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"))


Hope this helps,

Rui Barradas
Em 16-01-2013 08:52, e-letter escreveu:
Readers,

Am trying to use the function 'approx' to interpolate time series data sets:

data1:
01:23:40 5
01:23:45 10
01:23:50 12
01:23:55 7

data2:
01:23:42
01:23:47
01:23:51
01:23:54

The objective is to obtain interpolated values of 'data1' column 2 (5,
10, 12, 7) for the times shown in data2. Tried the following command
but received the error shown:

data3<-approx(data1,xout=data2)
Error in approx(data1, xout = data2) :
   (list) object cannot be coerced to type 'double'

What is my mistake please?

--
r2151

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to