Something like for(i in 1:20){ pdf(sprintf("myplot%d.pdf",i)) # your calculation and plots here dev.off() }
If you have 100 plots in total, then you should have 5 graphs in each single pdf. Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State University 3211 Snedecor Hall, Ames, IA On Tue, Sep 22, 2009 at 10:23 PM, David Winsemius <dwinsem...@comcast.net> wrote: > > On Sep 22, 2009, at 9:50 PM, Weiwei Shi wrote: > >> Hi there, >> >> I am wondering if there is a function in R to save plots automatically, >> like >> save() for R objects? I have e.g. 100 plots and I cannot put them in one >> pdf >> file so I split them, eg into 20 files, but I don't want to save one file >> each time. Can I use a function to do such save.plot as pdf? >> > > ?pdf > > >> > -- > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > ______________________________________________ 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.