[R-SIG-Mac] Re-creating PDF's

Fisher Dennis fisher at plessthan.com
Mon Oct 22 19:36:59 CEST 2012

R 2.15.1


In previous versions of OS X, I might do the following:
	1.  create a PDF in R
	2.  open the file using the command 
		system("open …")
	3.  create the file again (same commands as above).	
The opened file was replaced with the new version.
(This differs from Windows in which the file needed to be closed in order to create a new version)

As of Lion, it appears that something changed.  In some instances, the behavior is identical, i.e., creating the new version of the file results in the open version being replaced with the second version.  However, in some circumstances, I observe the following behavior:
	1.  the original version of the file remains open
	2.  the new version appears as a second instance of Preview
	3.  the system appears to freeze for a few seconds
	4.  Preview is frozen and requires a ForceQuit

Sample code is:
pdf("xx.pdf") ; plot(1); dev.off() ; system("open xx.pdf"); Sys.sleep(3) ; pdf("xx.pdf") ; plot(2); dev.off()

The code above results in the desired outcome and I can't provide a short reproducible example (the problem only happens with extremely large multipage documents).

Does anyone have any thoughts as to whether this is a problem in OS X (Preview) or R?  Any thoughts on how to prevent it from happening?  I suspect that this will be a un-solveable mystery but I thought that it was worth asking.


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)

More information about the R-SIG-Mac mailing list