This help topic is for R version 1.5.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/warning.html
warning {base}R Documentation

Warning Messages

Description

Generates a warning message that corresponds to its argument(s) and (optionally) the expression or function from which it was called.

Usage

warning(..., call. = TRUE)

Arguments

...

character vectors (which are pasted together with no separator) or NULL.

call.

logical, indicating if the call should become part of the warning message.

Details

The result depends on the value of options("warn").

If warn is negative warnings are ignored; if it is zero they are stored and printed after the top–level function has completed; if it is one they are printed as they occur and if it is 2 (or larger) warnings are turned into errors.

If warn is zero (the default), a top-level variable last.warning is created. It contains the warnings which can be printed via a call to warnings.

See Also

stop for fatal errors, warnings, and options with argument warn=.

Examples


testit <- function() warning("testit")
testit() ## shows call
testit <- function() warning("problem in testit", call. = FALSE)
testit() ## no call


[Package base version 1.5.0 ]