I am trying to create plots within a for loop and output them to a pdf. Here is a working example using plot:
gg <- data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { plot(gg$datadate, gg$spread, main=i) } dev.off() I am trying to learn more about ggplot2 so I try a slight modification and it doesn't work. Anyone know how to do this using qplot in ggplot2? gg <- data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { qplot(gg$datadate, gg$spread, geom="line", main=i) } dev.off() *************************************************************** This message is for the named person's use only. It may\...{{dropped:20}} ______________________________________________ R-help@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.