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

Berend Hasselman bhh at xs4all.nl
Mon Oct 22 22:00:31 CEST 2012

On 22-10-2012, at 19:36, Fisher Dennis <fisher at plessthan.com> wrote:

> R 2.15.1
> Lion
> Colleagues
> In previous versions of OS X, I might do the following:
> 	1.  create a PDF in R
> 		pdf(FILENAME)
> 		plot(1)
> 		dev.off() 
> 	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.

I've tried this on Mountain Lion but do not get two instances of preview.
One instance only. To check which version of the pdf Preview is displaying I changed the second plot command to plot(2,col="red"). Preview does not immediately show the second version (it doesn't reload the file) but when you switch focus to another app and return to Preview you see the changed pdf.
The initial pdf was not a version of the second (red dot) pdf.

I've tried this several times with the same results. One instance and no versions.


More information about the R-SIG-Mac mailing list