options {base} | R Documentation |
options
allows 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 However, only the ones below are used in “base R”. Further, |
prompt |
a string, used for R's prompt; should usually end in a
blank ( |
continue |
a string setting the prompt used for lines which continue over one line. |
width |
controls the number of characters on a line. You may want to change this if you re-size the window that R is running in. Valid values are 10...10000 with default normally 80. (The valid values are in file ‘Print.h’ and can be changed by re-compiling R.) |
digits |
controls the number of digits to print when printing numeric values. It is a suggestion only. Valid values are 1...22 with default 7. |
editor |
sets the default text editor, e.g., for
|
pager |
the (stand-alone) program used for displaying ASCII files on R's console. Defaults to ‘\$R\_HOME/bin/pager’. |
browser |
default HTML browser used by |
mailer |
default mailer used by |
contrasts |
the default |
expressions |
sets a limit on the number of nested expressions that will be evaluated. This is especially important on the Macintosh since stack overflow is likely if this is set too high. Valid values are 25...100000 with default 500. |
keep.source |
When The default is |
keep.source.pkgs |
As for |
na.action |
the name of a function for treating missing values
( |
papersize |
the default paper format used by |
printcmd |
the command used by |
latexcmd , dvipscmd |
character strings giving commands to be used in off-line printing of help pages. |
show.signif.stars , show.coef.Pvalues |
logical, affecting P value
printing, see |
ts.eps |
the relative tolerance for certain time series
( |
error |
either a function or an expression governing the handling
of non-catastrophic errors such as those generated by
|
show.error.messages |
a logical. Should error messages be
printed? Intended for use with |
warn |
sets the handling of warning messages. If |
check.bounds |
logical, defaulting to |
echo |
logical. Only used in non-interactive mode, when it
controls whether input is echoed. Command-line option
|
verbose |
logical. Should R report extra information on
progress? Set to |
device |
a character string giving the default device for that
session. This defaults to the normal screen device (e.g. |
X11colortype |
The default colour type for |
CRAN |
The URL of the preferred CRAN node for use by
|
download.file.method |
Method to be used for |
unzip |
the command used for unzipping help files.
Defaults to the value of |
de.cellwidth |
integer: the cell widths (number of characters)
to be used in the data editor |
encoding |
An integer vector of length 256 holding an input
encoding. Defaults to |
timeout |
integer. The timeout for Internet operations, in seconds. Default 60 seconds. |
internet.info |
The minimum level of information to be printed on url downloads etc. Default is 2, for failure causes. Set to 1 or 0 to get more information. |
x |
a character string holding one of the above option names. |
Invoking options()
with no arguments returns a list with the
current values of the options. Note that not all options listed above
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, for
S compatibility. You must use it “read only” however.
The default settings of some of these options are
prompt | "> " |
continue | "+ " |
width | 80 |
digits | 7 |
expressions | 500 |
keep.source | TRUE |
show.signif.stars | TRUE |
show.coef.Pvalues | TRUE |
na.action | na.omit |
ts.eps | 1e-5 |
error | NULL |
warn | 0 |
echo | TRUE |
verbose | FALSE
|
Others are set from environment variables or are platform-dependent.
A list (in any case) with the previous values of the options changed, or all options when no arguments were given.
options() # printing all current options
op <- options(); str(op) # nicer printing
# .Options is the same:
all(sapply(1:length(op), function(i) all(.Options[[i]] == op[[i]])))
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)
x <- NULL; x[4] <- "yes" # gives a warning
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 an error action for debugging: see ?debugger.
options(error=quote(dump.frames()))
## A possible setting for non-interactive sessions
options(error=quote({dump.frames(to.file=TRUE); q()}))
## End(Not run)