STA 290 Statistical Laboratory

 

Course Home | Calendar | Data | Computing | BlackBoard | Duke Statistics Home | Duke Home


R Resources:

Web Resources

 

PDF Documents

Books


Various hints

Within R, type q() to exit.

Type save.image() to save your workspace to the .RData file.

Type help.start() to get the html help to load in a netscape window.

Type, for example, ?lm to get help on the function lm.

Type x11() to open a new graphics window (or just type a plotting command and one will open automatically).

Type ls() or objects() to list the objects (data and functions) in your .RData file.

Type search() to see your search path.

Math expressions in plots

One of the nice additions to R (relative to Splus) is the easy inclusion of mathematical expressions in plots, using the function expression(). Take a look at the examples in the help file for the function legend, and consider the following:

 plot(rnorm(100),rnorm(100),xlab=expression(hat(mu)[0]),
      ylab=expression(alpha^beta),
      main=expression(paste("Plot of ", alpha^beta, " versus ", hat(mu)[0])))

 

You might also want to create an ~/.Rprofile file. R code in this file will be run anytime you start R, no matter what subdirectory you start in (unless there's an .Rprofile within that subdirectory, in which case that is read instead. Examples of what you may wish to put there include commands to modify the options and/or load certain packages (libraries).


Updated
August 23, 2004