The R graphical user interface (GUI) will open, containing a
single window called the console window.
The
greater-than sign ( >
) is R's "prompt;" it indicates
that R is ready for you to enter commands.
?read.table
or
help(read.table)
to get help on the function
read.table
.
help.search("read")
or
apropos("read")
to search for things in R
related to the word "read."
q()
at the command prompt.
You will be asked, "Save workspace image?" Click "Save" to save your work, "Don't Save" to discard your work, or "Cancel" to return to R.
The following is a subset of the resources available for learning and using R.
For the efficient use of R (on your own computer), it is useful to create a couple of start-up files, in order to set some default options or run some R commands automatically.
The file ~/.Renviron
is used to set certain
environment variables for R. I recommend a file containing the
following line, since, by default, R may assume that you want A4 paper.
R_PAPERSIZE=letter
The file ~/.Rprofile
is assumed to contain R code,
which is run at start-up. I recommend including something like the
following (to turn off the asterices that show up in significance tests).
You may also use this to automatically load an optional package.
options(show.signif.stars=FALSE)
R keeps your "workspace" of objects in a single file
(.RData
), which is read into RAM when R is started and
potentially written to disk at the end of a session. (Note: To
save your workspace without exiting, type save.image()
at
the R prompt. It is good to do this periodically, so that your work
is saved in case that R or your computer crashes.)
One may wish to have multiple R workspaces (i.e.,
.RData
files), one for each project or data set. In
Mac OSX, we do this as follows:
~/Rwork/Project1
and
~/Rwork/Project2
).
Use a text editor, such as TextEdit or an enhanced version (I like Smultron), to edit a file containing your commands. Use the Mac OSX keyboard shortcut Apple:Tab to quickly switch between R and your text editor.
Note that commands you type in R are saved
(temporarily) in the file .Rhistory
(in the same
directory as your .RData
file). You may wish to
peruse (or copy and paste from) this file and keep a
permanent record your analysis commands.
rm(list=ls())or use Workspace:Clear Workspace on the menu bar.
Last modified: Mon Jun 29 23:50:21 2009 |