Hello - I am trying to create a pdf file in R, but I keep getting an error that says it cannot open the pdf device. Here is the code and output:> pdf(file="test.pdf")Error in pdf(file = "test.pdf") : unable to start device pdf In addition: Warning message: In pdf(file = "test.pdf") : cannot open 'pdf' file argument 'test.pdf' Until yesterday I could use the pdf() function without problems, so I am not sure what happened. The error does not go away if I restart R or restart my computer. Any ideas??? -- View this message in context: http://www.nabble.com/pdf-creation-error-tp20096075p20096075.html Sent from the R help mailing list archive at Nabble.com.
On 10/21/2008 2:06 PM, j daniel wrote:> Hello - > > I am trying to create a pdf file in R, but I keep getting an error that says > it cannot open the pdf device. Here is the code and output: > >> pdf(file="test.pdf") > Error in pdf(file = "test.pdf") : unable to start device pdf > In addition: Warning message: > In pdf(file = "test.pdf") : cannot open 'pdf' file argument 'test.pdf' > > Until yesterday I could use the pdf() function without problems, so I am not > sure what happened. The error does not go away if I restart R or restart my > computer. Any ideas???You likely don't have write permission in the current directory. Use setwd() to change to a directory where you do, e.g. setwd(tempdir()) on most systems. Duncan Murdoch
You just don't have write access to the directory you are working in. That's what the second part of the message is telling you. HTH Ray Brownrigg Victoria University of Welington On Wed, 22 Oct 2008, j daniel wrote:> Hello - > > I am trying to create a pdf file in R, but I keep getting an error that > says > > it cannot open the pdf device. Here is the code and output: > > pdf(file="test.pdf") > > Error in pdf(file = "test.pdf") : unable to start device pdf > In addition: Warning message: > In pdf(file = "test.pdf") : cannot open 'pdf' file argument 'test.pdf' > > Until yesterday I could use the pdf() function without problems, so I am > not sure what happened. The error does not go away if I restart R or > restart my computer. Any ideas???
Hi JD, do you have the pdf open in some app, e.g., Acrobat Reader? If the file is open, R can't write on it. My (German) errors in this case look like yours: Fehler in pdf(paste(pic.directory, "/full_map.pdf", sep = "")) : unable to start device pdf Zus?tzlich: Warning message: In pdf(paste(pic.directory, "/full_map.pdf", sep = "")) : cannot open 'pdf' file argument 'Pictures/full_map.pdf' Just close the Acrobat Reader or whatever. Best, Stephan j daniel schrieb:> Hello - > > I am trying to create a pdf file in R, but I keep getting an error that says > it cannot open the pdf device. Here is the code and output: > >> pdf(file="test.pdf") > Error in pdf(file = "test.pdf") : unable to start device pdf > In addition: Warning message: > In pdf(file = "test.pdf") : cannot open 'pdf' file argument 'test.pdf' > > Until yesterday I could use the pdf() function without problems, so I am not > sure what happened. The error does not go away if I restart R or restart my > computer. Any ideas??? > > >