On Windows: The pdf("file1.pdf") command will throw an error if the file1.pdf is open in a viewer. For example:
pdf("file1.pdf") plot(1:10) dev.off() shell.exec("file1.pdf") pdf("file1.pdf") # Causes an error As suggested by the help page for file.access(), I normally use try(pdf("file1.pdf")) to test if file1.pdf is open. Oddly, I cannot do the same using cairo_pdf. For example: cairo_pdf("file2.pdf") plot(1:10) dev.off() shell.exec("file2.pdf") cairo_pdf("file2.pdf") # No error It is not until a plotting command is called that an error is generated. Is there a way to test if a pdf file can be written to by cairo_pdf ? I'd rather not wrap all plotting commands with try()....I have many such commands in my script and the choice of which one is first depends on user input. Kevin Wright [[alternative HTML version deleted]] ______________________________________________ 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.