[R] synchronisation of time series data using interpolation
Gabor Grothendieck
ggrothendieck at gmail.com
Mon Sep 28 14:38:15 CEST 2009
You should be using read.zoo, not read.table. This
read.zoo(textConnection(Lines1), ...)
becomes
read.zoo("test1.txt", ...)
etc. See ?read.zoo and read the three vignettes in the zoo package.
On Mon, Sep 28, 2009 at 8:13 AM, e-letter <inpost at gmail.com> wrote:
> I saved the data sets as files and then tried to refer to those files.
> Therefore the instruction:
>
>> z1<-read.zoo(textConnection("/path/to/test1.txt")
>
> means that I wanted to replace the manual data entry for Lines1 with a
> file containing the data. It seems that your instructions only work
> when data is typed from the command terminal. I cannot use data stored
> in separated files. Command terminal output below:
>
>> lines1<-read.table("/path/to/test1.txt")
>> lines2<-read.table("/path/to/test2.txt")
> Warning message:
> incomplete final line found by readTableHeader on '/path/to/test2.txt'
> in: read.table("/path/to/test2.txt")
>
> This is test1 file:
>
> 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
>
> This is test2 file:
>
> 01:00:12,20
> 01:01:01,55
> 01:01:55,22
>
> Then I added a carriage return in test2 file and saved it:
>
> 01:00:12,20
> 01:01:01,55
> 01:01:55,22
>
>
> Then I repeated the command terminal entry for lines2:
>
>> lines2<-read.table("/path/to/test2.txt")
>> library(zoo)
>> library(chron)
>> z1<-read.zoo(textConnection(lines1),header=FALSE,sep=",",FUN=times)
> Error in textConnection(lines1) : invalid 'text' argument
>
More information about the R-help
mailing list