[R] how to use a script file for all the codes?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sun Jul 4 16:29:54 CEST 2004
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
http://cran.r-project.org/other-software.html
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, 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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list