Readers, I have tried to use the zoo package to merge datasets and then use the coplot function, but the graph is not fully created. Only the panel data is shown. Command terminal output below, with csv files. What is the meaning of the warning message? Can anyone help please? rhelpatconference.jabber.org r 251 mandriva 2008> library(chron) > library(zoo) > z1<-read.zoo("test1.csv",header=FALSE,sep=",",FUN=times) > z2<-read.zoo("test2.csv",header=FALSE,sep=",",FUN=times) > z3<-read.zoo("test3.csv",header=FALSE,sep=",",FUN=times) > z4<-(na.approx(merge(z1,z2,z3),time(z1))) > coplot(z4$z2~z4$z1|z4$z3)Warning messages: 1: Index vectors are of different classes: integer times in: merge.zoo(e1, e2, all = FALSE, retclass = NULL) 2: Index vectors are of different classes: integer times in: merge.zoo(e1, e2, all = FALSE, retclass = NULL) 3: Index vectors are of different classes: integer times in: merge.zoo(e1, e2, all = FALSE, retclass = NULL) 4: Index vectors are of different classes: integer times in: merge.zoo(e1, e2, all = FALSE, retclass = NULL) 5: Index vectors are of different classes: integer times in: merge.zoo(e1, e2, all = FALSE, retclass = NULL) 6: Index vectors are of different classes: integer times in: merge.zoo(e1, e2, all = FALSE, retclass = NULL)> z4$z109:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10 320.61 325.43 320.48 315.53 314.63 313.73 316.11 323.88 09:52:30 09:52:54 331.65 328.48> z4$z209:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10 404.7500 402.7450 400.7400 300.2450 199.7500 266.7867 333.8233 400.8600 09:52:30 09:52:54 402.8350 404.8100> z4$z309:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10 166.120 175.770 185.420 198.395 211.370 214.820 218.270 221.720 09:52:30 09:52:54 228.370 235.020>test1.csv: 09:50:00,315.79 09:50:30,325.43 09:51:00,315.53 09:51:30,313.73 09:52:00,316.11 09:52:30,331.65 09:53:00,325.31 09:53:30,334.33 09:54:00,334.54 09:54:30,336.55 09:55:00,339.34 09:55:30,341.93 test2.csv: 09:50:01,404.75 09:50:44,400.74 09:51:27,199.75 09:52:10,400.86 09:52:54,404.81 09:53:41,404.36 09:54:20,406.11 09:55:03,408.85 test3.csv: 09:50:01,166.12 09:50:44,185.42 09:51:27,211.37 09:52:10,221.72 09:52:54,235.02 09:53:41,262.85 09:54:20,306.64 09:55:03,346.3
Gabor Grothendieck
2009-Nov-23 13:10 UTC
[R] unable to use coplot function with zoo package
You have no complete rows so how could it plot anything? If you had some complete rows then this should work: coplot(z1 ~ z2 | z3, as.data.frame(z4)) Lines1 <- "09:50:00,315.79 09:50:30,325.43 09:51:00,315.53 09:51:30,313.73 09:52:00,316.11 09:52:30,331.65 09:53:00,325.31 09:53:30,334.33 09:54:00,334.54 09:54:30,336.55 09:55:00,339.34 09:55:30,341.93" Lines2 <- "09:50:01,404.75 09:50:44,400.74 09:51:27,199.75 09:52:10,400.86 09:52:54,404.81 09:53:41,404.36 09:54:20,406.11 09:55:03,408.85" Lines3 <- "09:50:01,166.12 09:50:44,185.42 09:51:27,211.37 09:52:10,221.72 09:52:54,235.02 09:53:41,262.85 09:54:20,306.64 09:55:03,346.3" library(zoo) library(chron) z1 <- read.zoo(textConnection(Lines1), sep = ",", FUN = times) z2 <- read.zoo(textConnection(Lines2), sep = ",", FUN = times) z3 <- read.zoo(textConnection(Lines3), sep = ",", FUN = times) z4 <- merge(z1, z2, z3)> z4z1 z2 z3 09:50:00 315.79 NA NA 09:50:01 NA 404.75 166.12 09:50:30 325.43 NA NA 09:50:44 NA 400.74 185.42 09:51:00 315.53 NA NA 09:51:27 NA 199.75 211.37 09:51:30 313.73 NA NA 09:52:00 316.11 NA NA 09:52:10 NA 400.86 221.72 09:52:30 331.65 NA NA 09:52:54 NA 404.81 235.02 09:53:00 325.31 NA NA 09:53:30 334.33 NA NA 09:53:41 NA 404.36 262.85 09:54:00 334.54 NA NA 09:54:20 NA 406.11 306.64 09:54:30 336.55 NA NA 09:55:00 339.34 NA NA 09:55:03 NA 408.85 346.30 09:55:30 341.93 NA NA> packageDescription("zoo")$Version[1] "1.6-1"> R.version.string # Windows Vista[1] "R version 2.10.0 Patched (2009-11-21 r50532)" On Mon, Nov 23, 2009 at 5:25 AM, e-letter <inpost at gmail.com> wrote:> Readers, > > I have tried to use the zoo package to merge datasets and then use the > coplot function, but the graph is not fully created. Only the panel > data is shown. Command terminal output below, with csv files. What is > the meaning of the warning message? Can anyone help please? > > rhelpatconference.jabber.org > r 251 > mandriva 2008 > >> library(chron) >> library(zoo) >> z1<-read.zoo("test1.csv",header=FALSE,sep=",",FUN=times) >> z2<-read.zoo("test2.csv",header=FALSE,sep=",",FUN=times) >> z3<-read.zoo("test3.csv",header=FALSE,sep=",",FUN=times) >> z4<-(na.approx(merge(z1,z2,z3),time(z1))) >> coplot(z4$z2~z4$z1|z4$z3) > Warning messages: > 1: Index vectors are of different classes: integer times in: > merge.zoo(e1, e2, all = FALSE, retclass = NULL) > 2: Index vectors are of different classes: integer times in: > merge.zoo(e1, e2, all = FALSE, retclass = NULL) > 3: Index vectors are of different classes: integer times in: > merge.zoo(e1, e2, all = FALSE, retclass = NULL) > 4: Index vectors are of different classes: integer times in: > merge.zoo(e1, e2, all = FALSE, retclass = NULL) > 5: Index vectors are of different classes: integer times in: > merge.zoo(e1, e2, all = FALSE, retclass = NULL) > 6: Index vectors are of different classes: integer times in: > merge.zoo(e1, e2, all = FALSE, retclass = NULL) >> z4$z1 > 09:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10 > ?320.61 ? 325.43 ? 320.48 ? 315.53 ? 314.63 ? 313.73 ? 316.11 ? 323.88 > 09:52:30 09:52:54 > ?331.65 ? 328.48 >> z4$z2 > 09:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10 > 404.7500 402.7450 400.7400 300.2450 199.7500 266.7867 333.8233 400.8600 > 09:52:30 09:52:54 > 402.8350 404.8100 >> z4$z3 > 09:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10 > ?166.120 ?175.770 ?185.420 ?198.395 ?211.370 ?214.820 ?218.270 ?221.720 > 09:52:30 09:52:54 > ?228.370 ?235.020 >> > test1.csv: > 09:50:00,315.79 > 09:50:30,325.43 > 09:51:00,315.53 > 09:51:30,313.73 > 09:52:00,316.11 > 09:52:30,331.65 > 09:53:00,325.31 > 09:53:30,334.33 > 09:54:00,334.54 > 09:54:30,336.55 > 09:55:00,339.34 > 09:55:30,341.93 > test2.csv: > 09:50:01,404.75 > 09:50:44,400.74 > 09:51:27,199.75 > 09:52:10,400.86 > 09:52:54,404.81 > 09:53:41,404.36 > 09:54:20,406.11 > 09:55:03,408.85 > test3.csv: > 09:50:01,166.12 > 09:50:44,185.42 > 09:51:27,211.37 > 09:52:10,221.72 > 09:52:54,235.02 > 09:53:41,262.85 > 09:54:20,306.64 > 09:55:03,346.3 > > ______________________________________________ > R-help at 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. >