[R] Re: copying to the clipboard from the command line in Windows (was [R] Graphics ?)

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sat Dec 11 09:16:29 CET 1999

On Fri, 10 Dec 1999, Yves Gauvreau wrote:

> In the Windows version of R 0.65.1 I'd like to copy the results of a plot to
> the clipboard either as a bitmap or as a metafile. The same thing in fact as
> does the menu "Copy to the clipboard" provides but from the command line. I
> intend to use the DCOM server version of R to do plots, among other things
> and copy the results to the clipboard and show these on a picture box in my
> own VB application.

The answer is in the file gnuwin32/devga.c. Just see what the menu actually
calls. For a bitmap, you need to write some compiled code that calls
copytoclipboard. (Or use savePlot to write a bmp file, in rw0900 and

For a metafile, I believe you can use savePlot with file name "": you can
certainly use this to write to a file and then read it into your VB

However, why not plot directly to a metafile or bmp file and then display
that?  That avoids writing graphics on a screen somewhere that you don't
want displayed.

If you are doing this sort of thing you really need to keep fully
up-to-date with R versions. Thomas Baier's DCOM server (it is not a version
of R) has been updated, and you will need R 0.90.1 (due next week) to
run with version 0.91 of his server.  Or compile up R-release now.

A more informative subject line would be helpful.

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