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

Gabor Grothendieck ggrothendieck at myway.com
Sun Jul 4 17:01:17 CEST 2004


You can do this:

f <- function(x)x
fix(f)
# you are now put into an editor and can change the function
# when you save the file you will be taken back to R with the new version of f

Alternately, you can ease the use of the source style of operating
by hitting up-arrow a few times in the R console to get your last 
source command so its just a matter of upwarrowing and pressing Enter.

One other thing to note is that there are a number of editors that support
R syntax highlighting including ESS and gvim and that can ease development
too.

Jiacheng Yuan <jiachengyuan <at> hotmail.com> writes:

: 
: Hi there,
: 
: 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.
: 
: Any one can help me?
: Thank you very much!
: 
: Jia
: 
: ______________________________________________
: R-help <at> stat.math.ethz.ch mailing list
: https://www.stat.math.ethz.ch/mailman/listinfo/r-help
: PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
: 
:




More information about the R-help mailing list