[R] Why the variation when creating .pdf file output for my plots?

Erik Iverson eriki at ccbr.umn.edu
Wed Jun 30 16:58:28 CEST 2010

> Method 3:
>  > pdf(file="my_plot.pdf", paper="a4")
>  > dev.off()

The `pdf` function opens a *new* graphics device, you then send output 
to the device before calling dev.off(), e.g.,

pdf(file = my_plot.pdf")
plot(1:10, 1:10)

> -yields a .pdf file of 1kb (same plot example) and returns the following 
> error when attempting to open with Adobe acrobat:
> "There was an error opening this document. This file cannot be opened 
> because it has no pages."

More information about the R-help mailing list