warnings
Saved Warning Messages

Description

Provides access to saved warning messages.

Usage

warnings(...)

Arguments

... arguments to pass to the function cat when the returned object is printed. The most likely useful argument is file=, which redirects the warning printout to the specified file. See cat for the possible arguments.

Details

This function is used if prior execution has generated and saved warning messages. If the warn option (see options) has the value 0, any warnings are saved in the variable base::last.warning. The warnings function returns these saved warnings as an object of class "warnings".
Printing this object, done automatically at the end of a top-level expression that generated warnings, prints the list of saved warnings.
Value
returns an object of class warnings if there are any saved warnings; otherwise, returns NULL.
See Also
warning, options, cat.
Examples
options(warn=0)
warning("foo")
# prints one warning
warnings()
# prints saved warnings again
Package base version 6.1.1-7
Package Index