use zoo package with multiple column data sets
Please provide a reproducible examples. You can use the following style:
Lines <- "01:01:01 11 55
+ 01:01:04 22 66 + 01:01:07 33 77 + 01:01:10 44 88"
library(zoo) library(chron) z <- read.zoo(textConnection(Lines), FUN = times) z
V2 V3 01:01:01 11 55 01:01:04 22 66 01:01:07 33 77 01:01:10 44 88
On Fri, Jan 29, 2010 at 8:34 AM, e-letter <inpost at gmail.com> wrote:
Assuming my documentation is correct, my version shows faq 1 to refer
to duplicate times but if file2 is:
01:01:01 ? ? ? ?11 ? ? ?55
01:01:04 ? ? ? ?22 ? ? ?66
01:01:07 ? ? ? ?33 ? ? ?77
01:01:10 ? ? ? ?44 ? ? ?88
I cannot see what is duplicate? If I create two new files:
file3:
01:01:01 ? ? ? ?11
01:01:04 ? ? ? ?22
01:01:07 ? ? ? ?33
01:01:10 ? ? ? ?44
file4:
01:01:01 ? ? ? ?55
01:01:04 ? ? ? ?66
01:01:07 ? ? ? ?77
01:01:10 ? ? ? ?88
The previous commands work:
z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
z2<-read.zoo("path/to/file3.csv",header=TRUE,sep=",",FUN=times)
z3<-(na.approx(merge(z1,z2),time(z1)))
plot(z3$z1,z3$z2)
and:
z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
z2<-read.zoo("path/to/file4.csv",header=TRUE,sep=",",FUN=times)
z3<-(na.approx(merge(z1,z2),time(z1)))
plot(z3$z1,z3$z2)
Shouldn't I be able to have one file containing all the columns I want
to make graphs, instead of having to create numerous files of only two
columns of data?