[R] FW: S+ Script Files for R???

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Tue May 13 02:23:28 CEST 2003


On 12-May-03 Douglas Beare wrote:
>> I'm trying to get a bunch of hardened S+ users to switch to R.
>> They won't move because they have got addicted to the S+ (.ssc)
>> scripting files, available for MS windows versions.  In these files
>> you highlight the code you want to execute by mouse, press an arrow
>> in the menu, and it fires it off to the S+ compiler directly.  Is
>> such a facility actually available for Linux/Windows and Unix
>> versions of R? Is there something similar out there?

Despite recent replies (though mind you I'm not a user of ESS so can't
comment on what that offers, though my prior guess is that people who
like the pointy-clicky mindset of Windows are unlikely to adapt painlessly
to emacs), you can in fact do something very similar with X windows in
Unix/Linux. I have often done it, both with script files I'm writing
myself and especially with example scripts (sometimes complex applications
such as in the README for Schafer's MIX, working through it task by task
to see what happens along the way, sometimes the mini-examples which are
appended to the help files for R functions).

This works because in X windows highlighting a block of text automatically
copies it into the "paste" buffer, and middle-clicking the mouse copies
the "paste" buffer into whatever window is "in focus" at the moment of
clicking.

The procedure is very simple:

1. You have R running in an xterm in X windows.

Either:

2. You have another file with "script" (i.e. R code) open in another
   X window (you may be viewing the file with say 'less' or you may
   be editing it using whatever text editor you prefer). Then:

3. Position the mouse pointer to the beginning of the code you want to
   highlight, press the left button, and drag it to the end, thus
   highlighting the whole block. Then:

4. Move the mouse to the R window; bring this to the top by clicking
   on its top bar, and then with the mouse anywhere inside the window,
   press the middle button. The highlighted R code will then be copied
   into the R command window and executed. (Depending on how your
   window-manager is configured, it may be possible to short-cut this:
   highlight the code, move the pointer inside the R window, and simply
   press middle button).

Or:

5. You have been paging through a help file in the R window, and at the
   end there is some R code you want to try. While the pager is still up,
   highlight the block of code. Close the pager (e.g. with "q"). Then
   middle-click in the R window. Same effect as (4) above.

Since the basic moves in this are (A) Highlight the code, followed by
(B) Click the mouse, I don't see that this is any more demanding than
what your Windows users are used to, or indeed any different at all!

I hope this helps,
Ted.




More information about the R-help mailing list