R runs on the Cent-OS Department of Astronomy computers. To
start the program, type
at the command
prompt. R will start in the window. To get help on, for
instance, the plot command, type
You can then scroll up and down in the window, perhaps copying one of
the examples at the bottom, and then quit by typing
You can search for a command topic with
to get all the help pages involving the word plot.
If you have set the environment variable for the browser (see below), you can
for a nice HTML browser that links to command searches and
documentation including "An Introduction to R."
Apropos plotting, see
quit R, type
- plot for
the basic routine
- par for
setting plot parameters
- lines and points for
- curve for
- barplot for
- hist for making
- max, min, and range to
get the max and min.
It will ask if you want to save the environment. Answering yes
saves the command history (see history)
and whatever variables are in the working memory (see ls).
You can delete the variables in memory with rm(list=ls())
if you want to save the history but not the stuff in memory.
Quick notes on installing and using R packages
R comes with a pretty comprehensive set of functions in its base
"packages," but there are over 1500 additional packages contributed by
users. Some provide special functions, others code for specific
applications, some contain the routines for books. FITSio is a
package for reading and writing FITS files, for instance.
Downloading and installing the packages is easy.
Set up a local
user library directory and environment variables
Then, either add the
following to your .csh file or type at the command line (for just the
setenv R_PAPERSIZE 'letter'
Installing a package from a CRAN repository
Start R, then
(you will probably need to wait a little for the
repository drop-down to appear, then select repository)
Now that the package is installed, you load it
with the command
To get information on the package and its
at the R command line.
There is an "index" key at the bottom of the page to
show you the different commands, or for a specific command, type
To remove a package
Questions or comments? Please contact Andrew Harris.