warnings: Print Warning Messages

Description Usage Arguments Details Value Warning References See Also Examples

View source: R/warnings.R

Description

warnings and its print method print the variable last.warning in a pleasing form.

Usage

1

Arguments

...

arguments to be passed to cat.

Details

See the description of options("warn") for the circumstances under which there is a last.warning object and warnings() is used. In essence this is if options(warn = 0) and warning has been called at least once.

It is possible that last.warning refers to the last recorded warning and not to the last warning, for example if options(warn) has been changed or if a catastrophic error occurred.

Value

an object of S3 class "warnings", basically a named list.

Warning

It is undocumented where last.warning is stored nor that it is visible, and this is subject to change.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

warning.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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
tail(warnings(), 2) # see the last two warnings only (via '[' method)

robertzk/monadicbase documentation built on May 27, 2019, 10:35 a.m.