Skip to content

tilde expansion in graphics devices

2 messages · Tim Bergsma, Brian Ripley

#
Hi.

Use of tilde in filenames passed to graphics drivers crashes R on Mac
(2.7.1.45970/i386/9.4.0/MacBookPro3,1/2/4).  This is true in the GUI
as well as on the command line.  For example...

png("~/myplot.png")
plot(cos)
dev.off()

...causes a crash.  tiff() has the same problem.  jpeg() does not
crash, but the display of the image seems unreliable.

In Windows, all three issue a warning, though png() warns on
initialization, while tiff() warns on closure.

In both Windows and Mac, setwd("~/") has the expected effect,
suggesting that tilde expansion is supportable in principle.

Apologies if this is a known problem.

Tim Bergsma , PhD.
Metrum Research Group, LLC
#
On Mon, 1 Sep 2008, Tim Bergsma wrote:

            
A completely different device, as is the standard Unix one (and that does 
support tilde-expansion).
In principle, yes.  By the particular utility software used, not 
necessarily (which is why png and tiff behave differently on Windows).