[R] How to test for open pdf file on Windows before calling cairo_pdf ?
kw.stat at gmail.com
Thu Sep 11 22:06:17 CEST 2014
The pdf("file1.pdf") command will throw an error if the file1.pdf is open
in a viewer. For example:
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") # 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
[[alternative HTML version deleted]]
More information about the R-help