[R] productivity tools in R?

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jul 3 21:07:41 CEST 2009


On 7/3/2009 2:14 PM, cls59 wrote:
> 
> Duncan Murdoch-2 wrote:
>> 
>> The Windows GUI was written before the Mac GUI, and was written using a 
>> fairly strange toolkit, which are two reasons the Mac looks prettier. 
>> But the Windows GUI has a few advantages over the Mac: 
>> 
>> (snip)
>> 
>>   You can copy from the console, prompts and all, and paste just the 
>> commands, to re-execute a sequence of commands.
>> 
> 
> I recently noticed that the Mac GUI contains a way to do block selection- so
> you can select just the code you want to copy and exclude the prompts. Just
> hold down the option key and the text cursor will turn into a crosshair
> which allows you to exclude the prompt column while you select.

But doesn't that require you to edit out results?  The nice thing in the 
Windows Rgui is that it does everything for you.  So I can take a block 
of text like

 > x <- 1
 > x
[1] 1
 > y <- 2
 > y
[1] 2
 > x + y
[1] 3

and cut and "paste commands only" to re-execute it, without manually 
editing out the [1] 1, [1] 2, [1] 3 lines.  (Tony Plate contributed this 
code way back in R 1.9.0; thanks Tony!)

> Even better, this behavior is somewhat universal as it works in other
> applications such as the Terminal. I find it particularly useful for copying
> code out of Vim without getting Vim's line numbers wrapped up in my
> selections.

I think there's something of a culture clash here.  I consider it 
torture to use an editor that does that.  Line numbers are part of the 
frame around the text, they shouldn't be copied as part of the text.  (I 
was going to say I'd never use such an editor, but that's not true: 
sometimes I have no choice.)

Duncan Murdoch




More information about the R-help mailing list