options {base} | R Documentation |
Options Settings
Description
Allow the user to set and examine a variety of global options which affect the way in which R computes and displays its results.
Usage
options(...)
getOption(x, default = NULL)
.Options
Arguments
... |
any options can be defined, using Options can also be passed by giving a single unnamed argument which is a named list. |
x |
a character string holding an option name. |
default |
if the specified option is not set in the options list, this value is returned. This facilitates retrieving an option and checking whether it is set and setting it separately if not. |
Details
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, e.g., getOption("width")
rather than
options("width")
which is a list of length one.
Value
For getOption
, the current value set for option x
, or
default
(which defaults to 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).
Options used in base R
add.smooth
:typically logical, defaulting to
TRUE
. Could also be set to an integer for specifying how many (simulated) smooths should be added. This is currently only used byplot.lm
.askYesNo
:a function (typically set by a front-end) to ask the user binary response functions in a consistent way, or a vector of strings used by
askYesNo
to use as default responses for such questions.browserNLdisabled
:logical: whether newline is disabled as a synonym for
"n"
in the browser.catch.script.errors
:logical, false by default. If true and
interactive()
is false, e.g., when an R script is run byR CMD BATCH <script>.R
, then errors do not stop execution of the script. Rather evaluation continues after printing the error (and jumping to top level). Also,traceback()
would provide info about the error. Do use with care!checkPackageLicense
:logical, not set by default. If true,
loadNamespace
asks a user to accept any non-standard license at first load of the package.check.bounds
:logical, defaulting to
FALSE
. If true, a warning is produced whenever a vector (atomic orlist
) is extended, by something likex <- 1:3; x[5] <- 6
.CBoundsCheck
:logical, controlling whether
.C
and.Fortran
make copies to check for array over-runs on the atomic vector arguments.Initially set from value of the environment variable R_C_BOUNDS_CHECK (set to
yes
to enable).conflicts.policy
:character string or list controlling handling of conflicts found in calls to
library
orrequire
. Seelibrary
for details.continue
:a non-empty string setting the prompt used for lines which continue over one line.
defaultPackages
:the packages that are attached by default when R starts up. Initially set from the value of the environment variable R_DEFAULT_PACKAGES, or if that is unset to
c("datasets", "utils", "grDevices", "graphics", "stats", "methods")
. (Set R_DEFAULT_PACKAGES toNULL
or a comma-separated list of package names.) This option can be changed in a ‘.Rprofile’ file, but it will not work to exclude the methods package at this stage, as the value is screened for methods before that file is read.deparse.cutoff
:integer value controlling the printing of language constructs which are
deparse
d. Default60
.deparse.max.lines
:controls the number of lines used when deparsing in
browser
, upon entry to a function whose debugging flag is set, and if optiontraceback.max.lines
is unset, oftraceback()
. Initially unset, and only used if set to a positive integer.traceback.max.lines
:controls the number of lines used when deparsing in
traceback
, if set. Initially unset, and only used if set to a positive integer.digits
:controls the number of significant (see
signif
) digits to print when printing numeric values. It is a suggestion only. Valid values are 1...22 with default 7. See the note inprint.default
about values greater than 15.digits.secs
:controls the maximum number of digits to print when formatting time values in seconds. Valid values are 0...6 with default 0 (equivalent to
NULL
which is used when it is undefined as on vanilla startup). Seestrftime
.download.file.extra
:Extra command-line argument(s) for non-default methods: see
download.file
.download.file.method
:Method to be used for
download.file
. Currently download methods"internal"
,"wininet"
(Windows only),"libcurl"
,"wget"
and"curl"
are available. If not set,method = "auto"
is chosen: seedownload.file
.echo
:logical. Only used in non-interactive mode, when it controls whether input is echoed. Command-line option --no-echo sets this to
FALSE
, but otherwise it starts the session asTRUE
.encoding
:The name of an encoding, default
"native.enc"
. Seeconnections
.error
:either a function or an expression governing the handling of non-catastrophic errors such as those generated by
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. By default the option is not set: seestop
for the behaviour in that case. The functionsdump.frames
andrecover
provide alternatives that allow post-mortem debugging. Note that these need to specified as e.g.options(error = utils::recover)
in startup files such as ‘.Rprofile’.expressions
:sets a limit on the number of nested expressions that will be evaluated. Valid values are 25...500000 with default 5000. If you increase it, you may also want to start R with a larger protection stack; see --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. Once the limit is reached an error is thrown. The current number under evaluation can be found by callingCstack_info
.interrupt
:a function taking no arguments to be called on a user interrupt if the interrupt condition is not otherwise handled.
keep.parse.data
:When internally storing source code (
keep.source
is TRUE), also store parse data. Parse data can then be retrieved withgetParseData()
and used e.g. for spell checking of string constants or syntax highlighting. The value has effect only when internally storing source code (seekeep.source
). The default isTRUE
.keep.parse.data.pkgs
:As for
keep.parse.data
, used only when packages are installed. Defaults toFALSE
unless the environment variable R_KEEP_PKG_PARSE_DATA is set toyes
. The space overhead of parse data can be substantial even after compression and it causes performance overhead when loading packages.keep.source
:When
TRUE
, the source code for functions (newly defined or loaded) is stored internally allowing comments to be kept in the right places. Retrieve the source by printing or usingdeparse(fn, control = "useSource")
.The default is
interactive()
, i.e.,TRUE
for interactive use.keep.source.pkgs
:As for
keep.source
, used only when packages are installed. Defaults toFALSE
unless the environment variable R_KEEP_PKG_SOURCE is set toyes
.matprod
:a string selecting the implementation of the matrix products
%*%
,crossprod
, andtcrossprod
for double and complex vectors:"internal"
uses an unoptimized 3-loop algorithm which correctly propagates
NaN
andInf
values and is consistent in precision with other summation algorithms inside R likesum
orcolSums
(which now means that it uses along double
accumulator for summation if available and enabled, seecapabilities
)."default"
uses BLAS to speed up computation, but to ensure correct propagation of
NaN
andInf
values it uses an unoptimized 3-loop algorithm for inputs that may containNaN
orInf
values. When deemed beneficial for performance,"default"
may call the 3-loop algorithm unconditionally, i.e., without checking the input forNaN
/Inf
values. The 3-loop algorithm uses (only) adouble
accumulator for summation, which is consistent with the reference BLAS implementation."blas"
uses BLAS unconditionally without any checks and should be used with extreme caution. BLAS libraries do not propagate
NaN
orInf
values correctly and for inputs withNaN
/Inf
values the results may be undefined."default.simd"
is experimental and will likely be removed in future versions of R. It provides the same behavior as
"default"
, but the check whether the input containsNaN
/Inf
values is faster on some SIMD hardware. On older systems it will run correctly, but may be much slower than"default"
.
max.print
:integer, defaulting to
99999
.print
orshow
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
:character string containing a single character. The preferred character to be used as the decimal point in output conversions, that is in printing, plotting,
format
,formatC
andas.character
but not when deparsing nor bysprintf
(which is sometimes used prior to printing).pager
:the command used for displaying text files by
file.show
, details depending on the platform:- On a unix-alike
defaults to ‘R_HOME/bin/pager’, which is a shell script running the command-line specified by the environment variable PAGER whose default is set at configuration, usually to
less
.- On Windows
defaults to
"internal"
, which uses a pager similar to the GUI console. Another possibility is"console"
to use the console itself.
Can be a character string or an R function, in which case it needs to accept the arguments
(files, header, title, delete.file)
corresponding to the first four arguments offile.show
.papersize
:the default paper format used by
postscript
; set by environment variable R_PAPERSIZE when R is started: if that is unset or invalid it defaults platform dependently- on a unix-alike
to a value derived from the locale category
LC_PAPER
, or if that is unavailable to a default set when R was built.- on Windows
to
"a4"
, or"letter"
in US and Canadian locales.
PCRE_limit_recursion
:Logical: should
grep(perl = TRUE)
and similar limit the maximal recursion allowed when matching? Only relevant for PCRE1 and PCRE2 <= 10.23.PCRE can be built not to use a recursion stack (see
pcre_config
), but it uses recursion by default with a recursion limit of 10000000 which potentially needs a very large C stack: see the discussion at https://www.pcre.org/original/doc/html/pcrestack.html. If true, the limit is reduced using R's estimate of the C stack size available (if known), otherwise 10000. IfNA
, the limit is imposed only if any input string has 1000 or more bytes. The limit has no effect when PCRE's Just-in-Time compiler is used.PCRE_study
:Logical or integer: should
grep(perl = TRUE)
and similar ‘study’ the patterns? Either logical or a numerical threshold for the minimum number of strings to be matched for the pattern to be studied (the default is10
)). Missing values and negative numbers are treated as false. This option is ignored with PCRE2 (PCRE version >= 10.00) which does not have a separate study phase and patterns are automatically optimized when possible.PCRE_use_JIT
:Logical: should
grep(perl = TRUE)
,strsplit(perl = TRUE)
and similar make use of PCRE's Just-In-Time compiler if available? (This applies only to studied patterns with PCRE1.) Default: true. Missing values are treated as false.pdfviewer
:default PDF viewer. The default is set from the environment variable R_PDFVIEWER, the default value of which
- on a unix-alike
is set when R is configured, and
- on Windows
is the full path to
open.exe
, a utility supplied with R.
printcmd
:the command used by
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. Usually set to"lpr"
on a Unix-alike.prompt
:a non-empty string to be used for R's prompt; should usually end in a blank (
" "
).rl_word_breaks
:(Unix only:) Used for the readline-based terminal interface. Default value
" \t\n\"\\'`><=%;,|&{()}"
.This is the set of characters use to break the input line into tokens for object- and file-name completion. Those who do not use spaces around operators may prefer
" \t\n\"\\'`><=+-*%;,|&{()}"
save.defaults
,save.image.defaults
:-
see
save
. scipen
:integer. A penalty to be applied when deciding to print numeric values in fixed or exponential notation. Positive values bias towards fixed and negative towards scientific notation: fixed notation will be preferred unless it is more than
scipen
digits wider.setWidthOnResize
:a logical. If set and
TRUE
, R run in a terminal using a recentreadline
library will set thewidth
option when the terminal is resized.showWarnCalls
,showErrorCalls
:a logical. Should warning and error messages produced by the default handlers show a summary of the call stack? By default error call stacks are shown in non-interactive sessions. When
warning
orstop
are called on a condition object the call stacks are only shown if the value returned byconditionCall
for the condition object is notNULL
.showNCalls
:integer. Controls how long the sequence of calls must be (in bytes) before ellipses are used. Defaults to 50 and should be at least 30 and no more than 500.
show.error.locations
:Should source locations of errors be printed? If set to
TRUE
or"top"
, the source location that is highest on the stack (the most recent call) will be printed."bottom"
will print the location of the earliest call found on the stack.Integer values can select other entries. The value
0
corresponds to"top"
and positive values count down the stack from there. The value-1
corresponds to"bottom"
and negative values count up from there.show.error.messages
:a logical. Should error messages be printed? Intended for use with
try
or a user-installed error handler.texi2dvi
:used by functions
texi2dvi
andtexi2pdf
in package tools.- unix-alike only:
-
Set at startup from the environment variable R_TEXI2DVICMD, which defaults first to the value of environment variable TEXI2DVI, and then to a value set when R was installed (the full path to a
texi2dvi
script if one was found). If necessary, that environment variable can be set to"emulation"
.
timeout
:positive integer. The timeout for some Internet operations, in seconds. Default 60 (seconds) but can be set from environment variable R_DEFAULT_INTERNET_TIMEOUT. (Invalid values of the option or the variable are silently ignored: non-integer numeric values will be truncated.) See
download.file
andconnections
.topLevelEnvironment
:see
topenv
andsys.source
.url.method
:character string: the default method for
url
. Normally unset, which is equivalent to"default"
, which is"internal"
except on Windows.useFancyQuotes
:controls the use of directional quotes in
sQuote
,dQuote
and in rendering text help (seeRd2txt
in package tools). Can beTRUE
,FALSE
,"TeX"
or"UTF-8"
.verbose
:logical. Should R report extra information on progress? Set to
TRUE
by the command-line option --verbose.warn
:integer value to set the handling of warning messages by the default warning handler. If
warn
is negative all warnings are ignored. Ifwarn
is zero (the default) warnings are stored until the top–level function returns. If 10 or fewer warnings were signalled they will be printed otherwise a message saying how many were signalled. An object calledlast.warning
is created and can be printed through the functionwarnings
. Ifwarn
is one, warnings are printed as they occur. Ifwarn
is two (or larger, coercible to integer), all warnings are turned into errors. While sometimes useful for debugging, turning warnings into errors may trigger bugs and resource leaks that would not have been triggered otherwise.warnPartialMatchArgs
:logical. If true, warns if partial matching is used in argument matching.
warnPartialMatchAttr
:logical. If true, warns if partial matching is used in extracting attributes via
attr
.warnPartialMatchDollar
:logical. If true, warns if partial matching is used for extraction by
$
.warning.expression
:an R code expression to be called if a warning is generated, replacing the standard message. If non-null it is called irrespective of the value of option
warn
.warning.length
:sets the truncation limit in bytes for error and warning messages. A non-negative integer, with allowed values 100...8170, default 1000.
nwarnings
:the limit for the number of warnings kept when
warn = 0
, default 50. This will discard messages if called whilst they are being collected. If you increase this limit, be aware that the current implementation pre-allocates the equivalent of a named list for them, i.e., do not increase it to more than say a million.width
:controls the maximum number of columns on a line used in printing vectors, matrices and arrays, and when filling by
cat
.Columns are normally the same as characters except in East Asian languages.
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 limits on valid values are in file ‘Print.h’ and can be changed by re-compiling R.) Some R consoles automatically change the value when they are resized.
See the examples on Startup for one way to set this automatically from the terminal width when R is started.
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 |
warning.length | 1000 |
width | 80 |
Others are set from environment variables or are platform-dependent.
Options set in package grDevices
These will be set when package grDevices (or its namespace) is loaded if not already set.
bitmapType
:(Unix only, incl. macOS) character. The default type for the bitmap devices such as
png
. Defaults to"cairo"
on systems where that is available, or to"quartz"
on macOS where that is available.device
:a character string giving the name of a function, or the function object itself, which when called creates a new graphics device of the default type for that session. The value of this option defaults to the normal screen device (e.g.,
X11
,windows
orquartz
) for an interactive session, andpdf
in batch use or if a screen is not available. If set to the name of a device, the device is looked for first from the global environment (that is down the usual search path) and then in the grDevices namespace.The default values in interactive and non-interactive sessions are configurable via environment variables R_INTERACTIVE_DEVICE and R_DEFAULT_DEVICE respectively.
The search logic for ‘the normal screen device’ is that this is
windows
on Windows, andquartz
if available on macOS (running at the console, and compiled into the build). OtherwiseX11
is used if environment variable DISPLAY is set.device.ask.default
:logical. The default for
devAskNewPage("ask")
when a device is opened.locatorBell
:logical. Should selection in
locator
andidentify
be confirmed by a bell? DefaultTRUE
. Honoured at least onX11
andwindows
devices.windowsTimeout
:(Windows-only) integer vector of length 2 representing two times in milliseconds. These control the double-buffering of
windows
devices when that is enabled: the first is the delay after plotting finishes (default 100) and the second is the update interval during continuous plotting (default 500). The values at the time the device is opened are used.
Other options used by package graphics
max.contour.segments
:positive integer, defaulting to
25000
if not set. A limit on the number of segments in a single contour line incontour
orcontourLines
.
Options set in package stats
These will be set when package stats (or its namespace) is loaded if not already set.
contrasts
:the default
contrasts
used in model fitting such as withaov
orlm
. 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 namedc("unordered", "ordered")
, but the names are unused.na.action
:the name of a function for treating missing values (
NA
's) for certain situations, seena.action
andna.pass
.show.coef.Pvalues
:logical, affecting whether P values are printed in summary tables of coefficients. See
printCoefmat
.show.nls.convergence
:logical, should
nls
convergence messages be printed for successful fits?show.signif.stars
:logical, should stars be printed on summary tables of coefficients? See
printCoefmat
.ts.eps
:the relative tolerance for certain time series (
ts
) computations. Default1e-05
.ts.S.compat
:logical. Used to select S compatibility for plotting time-series spectra. See the description of argument
log
inplot.spec
.
Options set (or used) in package utils
These will be set (apart from Ncpus
) when package utils
(or its namespace) is loaded if not already set.
BioC_mirror
:The URL of a Bioconductor mirror for use by
setRepositories
, e.g. the default ‘"https://bioconductor.org"’ or the European mirror ‘"https://bioconductor.statistik.tu-dortmund.de"’. Can be set bychooseBioCmirror
.browser
:The HTML browser to be used by
browseURL
. This sets the default browser on UNIX or a non-default browser on Windows. Alternatively, an R function that is called with a URL as its argument. SeebrowseURL
for further details.ccaddress
:default Cc: address used by
create.post
(and hencebug.report
andhelp.request
). Can beFALSE
or""
.citation.bibtex.max
:default 1; the maximal number of bibentries (
bibentry
) in acitation
for which the BibTeX version is printed in addition to the text one.de.cellwidth
:integer: the cell widths (number of characters) to be used in the data editor
dataentry
. If this is unset (the default), 0, negative orNA
, variable cell widths are used.demo.ask
:default for the
ask
argument ofdemo
.editor
:a non-empty character string or an R function that sets the default text editor, e.g., for
edit
andfile.edit
. Set from the environment variable EDITOR on UNIX, or if unset VISUAL orvi
. As a string it should specify the name of or path to an external command.example.ask
:default for the
ask
argument ofexample
.help.ports
:optional integer vector for setting ports of the internal HTTP server, see
startDynamicHelp
.help.search.types
:default types of documentation to be searched by
help.search
and??
.help.try.all.packages
:default for an argument of
help
.help_type
:default for an argument of
help
, used also as the help type by?
.help.htmlmath
:default for the
texmath
argument ofRd2HTML
, controlling how LaTeX-like mathematical equations are displayed in R help pages (if enabled). Useful values are"katex"
(equivalent toNULL
, the default) and"mathjax"
; for all other values basic substitutions are used.help.htmltoc
:default for the
toc
argument ofRd2HTML
, controlling whether a table of contents should be included.HTTPUserAgent
:string used as the ‘user agent’ in HTTP(S) requests by
download.file
,url
andcurlGetHeaders
, orNULL
when requests will be made without a user agent header. The default is"R (version platform arch os)"
except when ‘libcurl’ is used when it is"libcurl/version"
for the ‘libcurl’ version in use.install.lock
:logical: should per-directory package locking be used by
install.packages
? Most useful for binary installs on macOS and Windows, but can be used in a startup file for source installs viaR CMD INSTALL
. For binary installs, can also be the character string"pkglock"
.internet.info
:The minimum level of information to be printed on URL downloads etc, using the
"internal"
and"libcurl"
methods. Default is 2, for failure causes. Set to 1 or 0 to get more detailed information (for the"internal"
method 0 provides more information than 1).install.packages.check.source
:Used by
install.packages
(and indirectlyupdate.packages
) on platforms which support binary packages. Possible values"yes"
and"no"
, with unset being equivalent to"yes"
.install.packages.compile.from.source
:Used by
install.packages(type = "both")
(and indirectlyupdate.packages
) on platforms which support binary packages. Possible values are"never"
,"interactive"
(which means ask in interactive use and"never"
in batch use) and"always"
. The default is taken from environment variable R_COMPILE_AND_INSTALL_PACKAGES, with default"interactive"
if unset. However,install.packages
uses"never"
unless amake
program is found, consulting the environment variable MAKE.mailer
:default emailing method used by
create.post
and hencebug.report
andhelp.request
.menu.graphics
:Logical: should graphical menus be used if available? Defaults to
TRUE
. Currently applies toselect.list
,chooseCRANmirror
,setRepositories
and to select from multiple (text) help files inhelp
.Ncpus
:an integer
n \ge 1
, used ininstall.packages
as default for the number of CPUs to use in a potentially parallel installation, asNcpus = getOption("Ncpus", 1L)
, i.e., when unset is equivalent to a setting of 1.pkgType
:The default type of packages to be downloaded and installed – see
install.packages
. Possible values are platform dependently- on Windows
-
"win.binary"
,"source"
and"both"
(the default). - on Unix-alikes
"source"
(the default except under a CRAN macOS build),"mac.binary"
and"both"
(the default for CRAN macOS builds). ("mac.binary.el-capitan"
,"mac.binary.mavericks"
,"mac.binary.leopard"
and"mac.binary.universal"
are no longer in use.)
Value
"binary"
is a synonym for the native binary type (if there is one);"both"
is used byinstall.packages
to choose between source and binary installs.repos
:character vector of repository URLs for use by
available.packages
and related functions. Initially set from entries marked as default in the ‘repositories’ file, whose path is configurable via environment variable R_REPOSITORIES (set this toNULL
to skip initialization at startup). The ‘factory-fresh’ setting from the file inR.home("etc")
isc(CRAN="@CRAN@")
, a value that causes some utilities to prompt for a CRAN mirror. To avoid this do set the CRAN mirror, by something likelocal({ r <- getOption("repos") r["CRAN"] <- "https://my.local.cran" options(repos = r) })
in your ‘.Rprofile’, or use a personal ‘repositories’ file.
Note that you can add more repositories (Bioconductor, R-Forge, RForge.net, ...) for the current session using
setRepositories
.str
:a list of options controlling the default
str
display. Defaults tostrOptions()
.str.dendrogram.last
:see
str.dendrogram
.SweaveHooks
,SweaveSyntax
:-
see
Sweave
. unzip
:a character string used by
unzip
: the path of the external programunzip
or"internal"
. Defaults (platform dependently)- on unix-alikes
to the value of R_UNZIPCMD, which is set in ‘etc/Renviron’ to the path of the
unzip
command found during configuration and otherwise to""
.- on Windows
to
"internal"
when the internal unzip code is used.
Options set in package parallel
These will be set when package parallel (or its namespace) is loaded if not already set.
mc.cores
:an integer giving the maximum allowed number of additional R processes allowed to be run in parallel to the current R process. Defaults to the setting of the environment variable MC_CORES if set. Most applications which use this assume a limit of
2
if it is unset.
Options used on Unix only
dvipscmd
:character string giving a command to be used in the (deprecated) off-line printing of help pages via PostScript. Defaults to
"dvips"
.
Options used on Windows only
warn.FPU
:logical, by default undefined. If true, a warning is produced whenever dyn.load repairs the control word damaged by a buggy DLL.
Note
For compatibility with S there is a visible object .Options
whose
value is a pairlist containing the current options()
(in no
particular order). Assigning to it will make a local copy and not
change the original. (Using it however is faster than calling
options()
).
An option set to NULL
is indistinguishable from a non existing
option.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
Examples
op <- options(); utils::str(op) # op is a named list
getOption("width") == options()$width # the latter needs more memory
options(digits = 15)
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)
# Compare the two ways to get an option and use it
# acconting for the possibility it might not be set.
if(as.logical(getOption("performCleanp", TRUE)))
cat("do cleanup\n")
## Not run:
# a clumsier way of expressing the above w/o the default.
tmp <- getOption("performCleanup")
if(is.null(tmp))
tmp <- TRUE
if(tmp)
cat("do cleanup\n")
## End(Not run)