| options {base} | R Documentation |
Allow the user to set and examine a variety of global “options” which affect the way in which R computes and displays its results.
options(...) getOption(x) .Options
... |
any options can be defined, using name = value or
by passing a list of such tagged values. However, only the ones
below are used in “base R”.
Further, options('name') == options()['name'], see the example.
|
x |
a character string holding an option name. |
Invoking options() with no arguments returns a list with the
current values of the options. Note that not all options listed below
are set initially. To access the value of a single option, one should
use getOption("width"), e.g., rather than
options("width") which is a list of length one.
.Options also always contains the options() list (as a
pairlist, unsorted), for S compatibility. Assigning to it will make a
local copy and not change the original.
For getOption, the current value set for option x, or
NULL if the option is unset.
For options(), a list of all set options sorted by name. For
options(name), a list of length one containing the set value,
or NULL if it is unset. For uses setting one or more options,
a list with the previous values of the options changed (returned
invisibly).
add.smooth:TRUE. Could also be set to an integer for specifying how
many (simulated) smooths should be added. This is currently only
used by plot.lm.check.bounds:FALSE. If
true, a warning is produced whenever a “generalized
vector” (atomic or list) is extended, by something
like x <- 1:3; x[5] <- 6.continue:defaultPackages:R_DEFAULT_PACKAGES, or if that is unset
to c("datasets", "utils", "grDevices", "graphics", "stats",
"methods"). (Set R_DEFAULT_PACKAGES to NULL or
a comma-separated list of package names.) A call to
options should be in your ‘.Rprofile’ file to ensure
that the change takes effect before the base package is
initialized (see Startup).deparse.max.lines:traceback and
browser. Initially unset, and only used if set to
a positive integer.digits:print.default.digits.secs:strftime.download.file.method:download.file. Currently download methods
"internal", "wget" and "lynx" are available.
There is no default for this option, when method = "auto"
is chosen: see download.file.echo:--slave sets this initially to FALSE.encoding:"native.enc"). See connections.error:stop as well as by signals and internally detected
errors. If the option is a function, a call to that function,
with no arguments, is generated as the expression. The default
value is NULL: see stop for the behaviour in
that case. The functions dump.frames and
recover provide alternatives that allow post-mortem
debugging.expressions:--max-ppsize in Memory. Note too that
you may cause a segfault from overflow of the C stack, and on OSes
where it is possible you may want to increase that.keep.source:TRUE, the source code for
functions (newly defined or loaded) is stored in their
"source" attribute (see attr) allowing
comments to be kept in the right places.
The default is interactive(), i.e., TRUE for
interactive use.
keep.source.pkgs:keep.source, for
functions in packages loaded by library or
require. Defaults to FALSE unless the
environment variable R_KEEP_PKG_SOURCE is set to
yes.
Note this does not apply to packages using lazy-loading or saved images. Whether they have kept source is determined when they are installed (and is almost certainly false).
mailer:bug.report(). Can be "none".max.contour.segments:250000 and usually not set. A limit on the number of
segments in a single contour line in contour or
contourLines.max.print:99999.
print or show methods can make use of
this option, to limit the amount of information that is printed,
to something in the order of (and typically slightly less than)
max.print entries.OutDec:as.character but not deparsing.pager:file.show and
sometimes help.
Defaults to ‘$R_HOME/bin/pager’.papersize:postscript; set by environment variable
R_PAPERSIZE when R is started: if that is unset or invalid
it defaults to
a value derived from the locale category LC_PAPER, or
if that is unavailable to a default set when R was built.printcmd:postscript
for printing; set by environment variable R_PRINTCMD when
R is started. This should be a command that expects either input
to be piped to ‘stdin’ or to be given a single filename
argument.prompt:" ").save.defaults, save.image.defaults:save.scipen:scipen digits wider.show.error.messages:try or a
user-installed error handler.stringsAsFactors:data.frame and read.table.texi2dvi:texi2dvi in namespace tools.timeout:download.file and connections.topLevelEnvironment:topenv and
sys.source.verbose:TRUE by the command-line option
--verbose.warn:warn is negative all warnings are ignored. If warn
is zero (the default) warnings are stored until the top–level
function returns. If fewer than 10 warnings were signalled they
will be printed otherwise a message saying how many (max 50) were
signalled. An object called last.warning is
created and can be printed through the function
warnings. If warn is one, warnings are
printed as they occur. If warn is two or larger all
warnings are turned into errors.warning.expression:warn.warnings.length:width:The ‘factory-fresh’ default settings of some of these options are
add.smooth | TRUE |
check.bounds | FALSE |
continue | "+ " |
digits | 7 |
echo | TRUE |
encoding | "native.enc" |
error | NULL |
expressions | 5000 |
keep.source | interactive() |
keep.source.pkgs | FALSE |
max.print | 99999 |
OutDec | "." |
prompt | "> " |
scipen | 0 |
show.error.messages | TRUE |
timeout | 60 |
verbose | FALSE |
warn | 0 |
warnings.length | 1000 |
width | 80 |
Others are set from environment variables or are platform-dependent.
These will be set when package grDevices (or its name space) is loaded if not already set.
device:x11, windows or quartz) for an
interactive session, and postscript in batch use or if a
screen is not available.locatorBell:locator
and identify be confirmed by a bell. Default TRUE.
Honoured at least on X11 and windows devices.par.ask.default:par("ask") when a device is opened.X11colortype:X11 devices. Default "true".X11fonts:X11.gamma:gamma for X11 devices, defaulting to 1
if unset (the default).These will be set when package stats (or its name space) is loaded if not already set.
contrasts:contrasts used in
model fitting such as with aov or lm.
A character vector of length two, the first giving the function to
be used with unordered factors and the second the function to be
used with ordered factors. By default the elements are named
c("unordered", "ordered"), but the names are unused.na.action:NA's) for certain situations.show.coef.Pvalues:printCoefmat.show.signif.stars:printCoefmat.ts.eps:ts) computations. Default 1e-05.ts.S.compat:log in plot.spec.These will be set when package utils (or its name space) is loaded if not already set.
browser:help.start() on UNIX, or a non-default browser on
Windows.de.cellwidth:dataentry.
If this is unset (the default), 0, negative or NA, variable
cell widths are used.editor:edit. Set from the environment variable
VISUAL on UNIX.example.ask:ask argument of
example.help.try.all.packages:help.HTTPUserAgent:NULL, HTTP requests will be made without a
user agent header. The default is R (<version> <platform>
<arch> <os>)internet.info:menu.graphics:TRUE. Currently applies
to chooseCRANmirror, setRepositories
and to select from multiple help files in help.pkgType:install.packages.
Possible values are "source" (the default except under the
CRAN Mac OS X build) and "mac.binary".repos:update.packages. Defaults to
c(CRAN="@CRAN@"), a value that causes some utilities to
prompt for a CRAN mirror. To avoid this do set the CRAN mirror,
by something like
local({r <- getOption("repos"); r["CRAN"] <- "http://my.local.cran";
options(repos=r)}).
Note that you can add more repositories (Bioconductor and
Omegahat, notably) using setRepositories().
SweaveHooks, SweaveSyntax:Sweave.unzip:R_UNZIPCMD, which is set in
‘etc/Renviron’ if an unzip command was found during
configuration.latexcmd, dvipscmd:pdfviewer:R_PDFVIEWER.Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
options() # printing all current options
op <- options(); str(op) # nicer printing
options('width')[[1]] == options()$width # the latter needs more memory
options(digits = 20)
pi
# set the editor, and save previous value
old.o <- options(editor = "nedit")
old.o
options(check.bounds = TRUE, warn = 1)
x <- NULL; x[4] <- "yes" # gives a warning
options(digits=5)
print(1e5)
options(scipen=3); print(1e5)
options(op) # reset (all) initial options
options('digits')
## Not run:
## set contrast handling to be like S
options(contrasts = c("contr.helmert", "contr.poly"))
## End(Not run)
## Not run:
## on error, terminate the R session with error status 66
options(error = quote(q("no", status=66, runLast=FALSE)))
stop("test it")
## End(Not run)
## Not run:
## Set error actions for debugging:
## enter browser on error, see ?recover:
options(error = recover)
## allows to call debugger() afterwards, see ?debugger:
options(error = dump.frames)
## A possible setting for non-interactive sessions
options(error = quote({dump.frames(to.file=TRUE); q()}))
## End(Not run)