[Rd] automatic "paste" filter to paste only the commands

Duncan Murdoch dmurdoch at pair.com
Sun Mar 7 05:18:43 MET 2004

Back in January, Tony Plate wrote this:

> >Just for fun (and actually because I would use it too) I wrote a
> >version of the "paste" menu command that assumes the clipboard
> >contains a transcript, and just pastes the commands from it into
> >the R console window (Windows GUI only).
> >
> >So, if something like this:
> >
> > > foo <-
> >+ 33
> > > foo * 3
> >[1] 99
> > > foo
> >[1] 33
> >
> >is on the clipboard, then the "paste commands" menu command will just paste
> >
> >foo <-
> >33
> >foo * 3
> >foo
> >
> >into the console window. (Resulting in this case in the original contents
> >of the clipboard being reproduced in the console window.)
> >
> >Is anyone interested in having this functionality in R?
> >
> >If there's enough interest in this to incorporate it into R, I'll package it
> >up as a patch (I did it in R 1.8.1).  (BTW, I only implemented it for the
> >Windows GUI, but it was pretty simple, so I'm sure if there's much
> >interest someone could easily port it to other GUIs).

I asked Tony to package this up, and he did so.  Tonight I committed
the code to r-devel, so it should show up in 1.9.0.

I'd appreciate it if people would try out the new code, which shows up
as new entries in the Edit and popup menus in the console and the file
viewing windows.  It's easy to overlook something when fiddling with
the GUI.

This will show up by Monday in the binary builds that appear on CRAN.
Remember to follow the link to the development build.

Duncan Murdoch

More information about the R-devel mailing list