Generates a warning message that corresponds to its argument(s) and (optionally) the expression or function from which it was called.
1 2 3
zero or more objects which can be coerced to character (and which are pasted together with no separator) or a single condition object.
logical, indicating if the call should become part of the warning message.
logical, indicating if the call should be output
immediately, even if
logical, indicating as far as possible the message should
be output as a single line when
expression to evaluate.
character, indicating which classes of warnings should be suppressed.
The result depends on the value of
options("warn") and on handlers established in the
If a condition object is supplied it should be the only argument, and further arguments will be ignored, with a message.
warning signals a warning condition by (effectively) calling
signalCondition. If there are no handlers or if all handlers
return, then the value of
warn = getOption("warn") is
used to determine the appropriate action. 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
warning(immediate. = TRUE) turns
warn = 1 for this call only.
warn is zero (the default), a read-only variable
last.warning is created. It contains the warnings which can be
printed via a call to
Warnings will be truncated to
characters, default 1000, indicated by
While the warning is being processed, a
is available. If this restart is invoked with
warning returns immediately.
An attempt is made to coerce other types of inputs to
to character vectors.
suppressWarnings evaluates its expression in a context that
ignores all warnings.
The warning message as
character string, invisibly.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
stop for fatal errors,
message for diagnostic messages,
options with argument
gettext for the mechanisms for the automated translation
1 2 3 4 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.