[R] Adding pagebreaks on files???

Gavin Simpson gavin.simpson at ucl.ac.uk
Mon Oct 29 21:33:54 CET 2007

On Mon, 2007-10-29 at 12:36 -0700, Tom.O wrote:
> Hi 
> Does anyone know if its possible to add pagebreaks to an pdf through an R
> command? I'm running a loop  where each session exports an pdf graph. Each
> image becomes a separate file, but I would like to have them in the same
> document but on separate pages.

see ?pdf and argument onefile, which should be true:

pdf("my_pdf.pdf", onefile = TRUE) # onefile = TRUE is default so redundant

> Does anyone know a solution or workaround?

You mention a loop and a session. I don't get this. By session do you
mean each iteration of the loop?

For this, you could use the following template:

pdf("my_loop_pdf.pdf", onefile = TRUE)
for(i in 1:10) {
plot(1:10 * i)

Is this what you wanted?

If not, you'll have to explain more.

> Regards, Tom


 Gavin Simpson                 [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk

More information about the R-help mailing list