[R] programming in R

Jason Turner jasont at indigoindustrial.co.nz
Mon Aug 12 09:07:21 CEST 2002

On Mon, Aug 12, 2002 at 05:55:43PM +0200, Alexandra Patriksson wrote:
> Do I have
> to create my files in some editor like emacs 

No, but it's easier once your commands get complicated.  Check out the R-WinEdt
if you're on Windows, too.  If you're familiar with emacs, life get a lot easier
with ESS and R.

> or can I write my code in the R
> prompt? 

Sure, for trying things out.  If you want to save what you did, help(savehistory)
will tell you how.

> How to compile the code?

You don't.  R is an interpreted language.  Compilation happens by running
the code through R.

The typical way most people start is with the source() command.  help(source)
will tell you what you need to know.

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

You need find the directory where R was installed (on Unix and Unix-like
systems, /usr/local/lib/R is the default; under Windows 
c:\Program files\R\rw1051\ is the default for R-1.5.1).  Under this
directory, there is a "doc/manual/" directory, which should contain several
pdf files.  R-intro.pdf, chapter 1, section 10 details how to recall saved functions
from file (created with your favorite editor), and chapter 10 answers the other 
questions that will arise once you start.  It's a very good, readable, comprehensive 

If you want to write packages (custom functions with full documentation, 
possibly with compiled code libraries, etc), the R-exts.pdf document in the
same directory is what you need (start with R-intro.pdf, though).


Indigo Industrial Controls Ltd.
jasont at indigoindustrial.co.nz
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