Consider
a1<-data.frame(a=c(1,2,3),b=c(45,34,67),c=c(35,56,89),d=c("first"))
a2<-data.frame(a=c(1,2,3),b=c(35,40,60),c=c(30,59,92),d=c("second"))
a3<-data.frame(a=c(1,2,3),b=c(45,38,57),c=c(35,52,91),d=c("third"))
I want to use ggplot to make three charts/plots corresponding to a1, a2, and a3. Each chart/plot should have x=a, and y=b,c. So there should be two lines in each chart. The charts should be named first, second, and third. How do I do this?
I tried
overall<-list(a1,a2,a3)
plots<-lapply(overall,function(category){o<-melt(category, id = "a", measure = c("b", "c"));
ggplot(o, aes(a, value, colour = variable)) + geom_line()})
but it produces only one plot. Ideally, I would like to see three plots with each plot containing two lines corresponding to b and c in data frames a1, a2, and a3.