\HeaderA{warnings}{Print Warning Messages}{warnings}
\aliasA{last.warning}{warnings}{last.warning}
\aliasA{print.warnings}{warnings}{print.warnings}
\keyword{programming}{warnings}
\keyword{error}{warnings}
\begin{Description}\relax
\code{warnings} and its \code{print} method print the
variable \code{last.warning} in a pleasing form.
\end{Description}
\begin{Usage}
\begin{verbatim}
warnings(...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{...}] arguments to be passed to \code{\LinkA{cat}{cat}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
See the description of \code{\LinkA{options}{options}("warn")} for the
circumstances under which there is a \code{last.warning} object and
\code{warnings()} is used.  In essence this is if \code{options(warn =
    0)} and \code{warning} has been called at least once.

It is possible that \code{last.warning} refers to the last recorded
warning and not to the last warning, for example if \code{options(warn)} has
been changed or if a catastrophic error occurred.
\end{Details}
\begin{Section}{Warning}
It is undocumented where \code{last.warning} is stored nor that it is
visible, and this is subject to change.  Prior to \R{} 2.4.0 it was
stored in the workspace, but no longer.
\end{Section}
\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{\LinkA{warning}{warning}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## NB this example is intended to be pasted in,
##    rather than run by example()
ow <- options("warn")
for(w in -1:1) {
   options(warn = w); cat("\n warn =",w,"\n")
   for(i in 1:3) { cat(i,"..\n"); m <- matrix(1:7, 3,4) }
}
warnings()
options(ow) # reset
\end{ExampleCode}
\end{Examples}

