The Art of R Programming

(WallPaper) #1
You can change your working directory by callingsetwd()with the
desired directory as a quoted argument. For example,

> setwd("q")

would set the working directory toq.
As you proceed through an interactive R session, R records the com-
mands you submit. If you answer yes to the question “Save workspace im-
age?” when you quit, R will save all the objects you created in that session
and restore them in your next session. This means you do not need to redo
the work from scratch to continue where you left off.
The saved workspace is in a file named.Rdata, which is located either
in the directory from which you invoked the R session (Linux) or in the R
installation directory (Windows). You can consult the.Rhistoryfile, which
records your commands, to remind yourself how that workspace was created.
If you want speedier startup/shutdown, you can skip loading all those
files and the saving of your session at the end by running R with thevanilla
option:

R --vanilla

Other options fall between vanilla and “load everything.” You can find
more information about startup files by querying R’s online help facility, as
follows:

> ?Startup

1.7 Getting Help...............................................................


A plethora of resources are available to help you learn more about R. These
include several facilities within R itself and, of course, on the Web.
Much work has gone into making R self-documenting. We’ll look
at some of R’s built-in help facilities and then at those available on the
Internet.

1.7.1 The help() Function..............................................


To get online help, invokehelp(). For example, to get information on the
seq()function, type this:

> help(seq)

The shortcut tohelp()is a question mark (?):

> ?seq

20 Chapter 1

Free download pdf