[R] programming in R

Jonathan Baron baron at cattell.psych.upenn.edu
Mon Aug 12 18:34:47 CEST 2002


On 08/12/02 17:55, Alexandra Patriksson wrote:
>I have a probably basic problem concerning the R language.
>I will write some small R programs but don't really know how to start. Do I have
>to create my files in some editor like emacs or can I write my code in the R
>prompt? 

Both.  But if it is more than just a few lines the editor method
is a good idea.  Then you save the file and run it with source(),
e.g., at the R prompt,
>source("myfile.R")

You can also save the code that you write when you quit a
session.  But if you are like me it is 25% stuff I want and 75%
mistakes.

A good technique is to use ESS (Emacs Speaks Statistics), which
allows you to go back and forth between the edited file that you
will save and the R prompt.  You can then easily "cut and paste"
the commands that work.

>How to compile the code?

I don't think you can do this.

>I haven't found any good manual parts about this subject.

You might look at the R for psychology thing in my R page below.
But I also think that this is in the manaul and in many of the
contributed documents in CRAN.

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:            http://www.sas.upenn.edu/~baron
R page:               http://finzi.psych.upenn.edu/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list