Help @ MC
The [R] environment
Help @ MC Logo
Centre for Mathematical Sciences, Lund University
    Print this page!
Home

Up to Help

Docs
R Help

Packages
CRAN
R.oo
aroma

Install
The R software
Most packages

Tips'n'Tricks
install.packages
Rgui (Windows)

External Links
R homepage
Download R
bioconductor.org
braju.com packages



Printer-friendly
Print this page



Powered by Google

R Help

R is a free software very similar to S-PLUS and it can be downloaded from http://www.r-project.org where you also find the wonderful quickly responding mailingslist r-help.

At the Centre for Mathematical Sciences, R is available on all Sun Solaris and Suse Linux machines by typing

 % R

at the prompt. Old (and new versions) of R can explicitly be accessed by Rnnn where nnn is the version number without dots, e.g. R181 for R v1.8.1 and so on.

R Coding and Documentation Conventions

Object-oriented programming in R

Programming with references

Local packages & bundles

Introduction to R

  • Emmanuel Paradis, R for Beginners, Université Montpellier II, France, Aug 2002. (pdf)
  • Jonathan Baron, Notes on the use of R for psychology experiments and questionnaires, University of Pennsylvania, Aug 2001. (HTML, pdf)
  • Ko-Kang Wang, R for Windows Users, Department of Statistics, New Zealand, October 2002. (HTML, pdf, ps, tex)
  • Ross Ihaka, Statistics 120 - Information Visualisation (HTML) - A great set of lecture notes and R packages for graphical presentation of data etc. Look at it!

Quick references to R

  • Jonathan Baron, R reference card, University of Pennsylvania, Aug 2001. ( pdf)
  • Robin Hankin, R For Octave [& Matlab] Users, 2001. (txt)

How to's and Code examples

R on Windows

  • H. Bengtsson, Windows bat file to get a Command prompt ready for R. See instructions in header comments. RCMDprompt.bat.

Other R help pages

  • R Help Center at the Institute de Statistique, Universite catholique de Louvain, Belgium

Miscellaneous

How do I print from R?

After you have created a plot you have to save it to file and from there print it. Example

  plot(sin(1:10))
  dev.print(postscript, file="/tmp/out.ps")
  system("lpr -Pps3 /tmp/out.ps")           # Call lpr from within R

How to autosave the command history

To save the command-line history automatically when exiting R just add the following in your ~/.Rprofile file:

.Last <- function() {
  savehistory();
}

Sweave

Sweave is a really great tool, which allows you to incorporate executable R code within for instance LaTeX documents. First Sweave() is called on your R-LaTeX hybrid document, the R code is extracted and evaluated. Figures that are generated are saved as EPS and PDF files, necessary LaTeX code to incorporate the figures in the LaTeX document is inserted in place. The final result is a LaTeX document (together with figure files), which can be compiled as usual. How does it work? See help(Sweave) in the tools package.

One common problem is that people encounter is that the Sweave.sty file is missing. It is located at ${RHOME}/share/texmf/Sweave.sty; just save it in the same directory as your LaTeX document.