factory: Catch errors and warnings and store them for subsequent...

Description Usage Arguments Value Author(s) References Examples

Description

Factory is not my code. Factory generates a function which is appropriately wrapped by error handlers. The result produced is a list. This is a nice way to recover from a loop problems that may have occured during loop evaluation. Check the references for additional related functions. I have not included the other factory functions because they did not play well with the return item as an S4 object.

Usage

1
  factory(fun)

Arguments

fun

The function to be turned into a factory

Value

list[3]: item 1 is the result from the function and $warn and $err contain warning and error messages respectively.

Author(s)

Martin Morgan; Packaged by Russell S. Pierce

References

http://stackoverflow.com/questions/4948361/how-do-i-save-warnings-and-errors-as-output-from-a-function

Examples

1
2
3
4
f.log <- factory(log)
f.log("a")
f.as.numeric <- factory(as.numeric)
f.as.numeric(c("a","b",1))

russmisc documentation built on May 2, 2019, 4:44 p.m.