[R] Unattended printing under Windows

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon Feb 26 08:52:23 CET 2001

On Sun, 25 Feb 2001, Michael Camann wrote:

> R-help list--
> I need to process a BUNCH of data in a very repetitious way (literally
> days of running the same simple analyses and producing summary graphics
> over and over).  I can't face the mind-numbing boredom of this task!
> I've written a brief function that automates the process and sink()'s the
> text output of each analysis to a report file (it generates dozens of
> the buggers) but can't figure out how to generate the graphical output,
> save it to a Windows metafile (minimum requirement) and optionally print
> it before moving on to the next iteration-- note that this needs to be
> done from the command line, not the GUI.  The whole point is to let this
> turkey run at night or some other time when I'm not there to click the
> mouse.  I used to do something similar with S-plus under unix using ps()
> and system() as I recall.  It's been a while, though, and I no longer have
> that code.  Can anyone geve me hints as to how best to accomplish this
> with R for windows?

Well, I am none too clear on the blockage point here, but let me try some
pointers.  BTW, as far as I know everything you can do from the GUI in R
you can do equivalently from the command line (even replay plots, but that
is more cumbersome in the CLI).

win.metafile() allows you to produce graphics as a Windows metafile.  You
can either dev.copy the plot to win.printer() to print it (not sure if that
runs unattended: it may depend on your Windows settings) or use system()
to print the file or even file.copy() to copy it to PRN:

You may wish to make use of R-1.2.2 (due today) that creates metafiles that
some applications (e.g. Word) is happier with).


Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list