Re: [R] overlaying plots from a list of data frames

2009-02-04 Thread baptiste auguie
Another option, library(ggplot2) qplot(year, value, data=melt(foo), color= L1) which can also be achieved "by hand", test<- do.call(rbind,foo) # combines all data.sets test$name <- do.call(rep, list(x=names(foo), times = unlist(lapply(foo,nrow # append the name of the original dataset

Re: [R] overlaying plots from a list of data frames

2009-02-04 Thread Gabor Grothendieck
Create a zoo object z and plot it: library(zoo) f <- function(x) zoo(x$data, levels(x$year)[x$year]) z <- do.call(merge, lapply(foo, f)) plot(z, screen = 1, col = 1:6, pch = 1:6, type = "o", ylab = "data", xlab = "year") legend("topright", legend = 1:6, lty = 1, pch = 1:6, col = 1:6) See