Re: [R] how to use a script file for all the codes?

From: Prof Brian Ripley <>
Date: Mon 05 Jul 2004 - 00:29:54 EST

On Sun, 4 Jul 2004, Jiacheng Yuan wrote:

> I am using the windows version R1.9.0.
> I used to be a Splus user. When I used Splus to try some computation, I like
> to put all my codes in a script file and check them line by line. This way I
> can keep track of all my thinking and it's very easy to make correction at
> some earlier steps.
> Now I can not find this script-file style in R. The software itself doesn't
> seem to have a script file editor. I can only use other editor software
> (e.g., notepad) to write a ".R" file, and then "source" it in R. It's not
> convenient to debug in this way.

You are not expected to. I usually copy and paste from an external editor, and rarely use source. Both S(-PLUS) and R have long had modes for editors allowing much more than the S-PLUS script windows: indeed they were copied from such modes. Take a look at

In ESS (and I believe R-WinEdt) you can submit code by highlighting and using an editor command.

> Any one can help me?

You can already display a file in RGui using the File menu, and highlight lines there and submit them. If you want to change them, use up-arrow and edit them in the commands buffer.

You could also try the R-devel prerelease (on CRAN), as it can edit such a displayed file.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Mon Jul 05 00:37:25 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:40 EST