[Rd] regarding saving R graphis images directly to directory

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Jun 21 13:00:45 CEST 2004


Martin Maechler wrote:

>>>>>>"Vadim" == Vadim Ogranovich <vograno at evafunds.com>
>>>>>>    on Sun, 20 Jun 2004 15:22:41 -0700 writes:
> 
> 
>     Vadim> If you just need to ignore the errors use try or tryCatch around the
>     Vadim> plotting functions.
> 
>     Vadim> Re: jpeg and friends. R has a notion of current
>     Vadim> device where it sends all its graphics. If none is
>     Vadim> open R opens the default device for you, which
>     Vadim> happens to be X11 on your system. To use a different
>     Vadim> device just open it, say jpeg, and all graphics will
>     Vadim> go there until you close it or open yet another
>     Vadim> device. For the list of available devices see
>     Vadim> ?Devices
> 
>     Vadim> It might be useful to have a null device which just
>     Vadim> silently ignores all graphics (aka /dev/null on
>     Vadim> UNIX), but I don't know if R has anything like this.
> 
> 
>     Vadim> P.S. This sort of questions looks more appropriate for r-help. Just
>     Vadim> personal sensing, I am no master of polices.
> 
> but you are very right, Vadim.  
> Saurin's question would have been appropriate only for R-help.
> 
> OTOH, your "P.S." above --- being a proposal for enhancing R ---
> does well fit into R-devel.
> 
> I agree that it would be nice to have a
>   nullDev() or dev.null()
> graphics device which would efficiently discard all "plotting to
> devices" graphics.  
> Note however that it should *not* discard the building of GROBs
> (graphical objects) [grid package], i.e. it would construct all
> these also for all lattice (or nlme) graphics.  It would just
> trash discard when grob's are being 'printed' (i.e. plotted).
> 
> A -- quite inefficient -- but easy way on Unix-alikes
> {i.e. everwhere but Windows}, 
> would be to call, e.g.,   postscript(file = "/dev/null")
> I assume there's something equivalent on modern Windows (?)

Martin, indeed, it's there since the days of DOS:

   postscript(file = "NUL")

hence even understood by my 8 year old OS Windows NT 4.0 ... ;-)

Uwe



More information about the R-devel mailing list