\Header{warning}{Warning Messages}
\alias{suppressWarnings}{warning}
\keyword{programming}{warning}
\keyword{error}{warning}
\begin{Description}\relax
Generates a warning message that corresponds to its argument(s) and
(optionally) the expression or function from which it was called.\end{Description}
\begin{Usage}
\begin{verbatim}
warning(..., call. = TRUE)
suppressWarnings(expr)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{...}] character vectors (which are pasted together with no
separator), a condition object, or \code{NULL}.
\item[\code{call.}] logical, indicating if the call should become part of the
warning message.
\item[\code{expr}] expression to evaluate.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The result \emph{depends} on the value of
\code{\Link{options}("warn")} and on handlers established in the
executing code.

\code{warning} signals a warning condition by (effectively) calling
\code{signalCondition}.  If there are no handlers or if all handlers
return, then the value of \code{warn} is used to determine the
appropriate action.  If \code{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 \code{warn} is zero (the default), a top-level variable
\code{last.warning} is created.  It contains the warnings which can be
printed via a call to \code{\Link{warnings}}.

Warnings will be truncated to \code{getOption("warning.length")}
characters, default 1000.

While the warning is being processed, a \code{muffleWarning} restart
is available.  If this restart is invoked with \code{invokeRestart},
then \code{warning} returns immediately.

\code{suppressWarnings} evaluates its expression in a context that
ignores all warnings.\end{Details}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.\end{References}
\begin{SeeAlso}\relax
\code{\Link{stop}} for fatal errors,
\code{\Link{warnings}},
and \code{\Link{options}} with argument \code{warn=}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

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

\end{ExampleCode}
\end{Examples}

