withWE: Evaluate expression and capture all warnings and errors if...

Description Usage Arguments Warning(s) Error Examples

View source: R/withWE.R

Description

Not exported. Strictly internal

Usage

1
withWE(expr)

Arguments

expr

The expression to be evaluated.

Warning(s)

Returns the value along with the warning message(s).

Error

Returns NA as the value along with the error message.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
foo <- function(){
  warning("oops")
}

withWE(foo)

foo <- function(){
  warning("oops")
  warning("again oops")
  1
}

withWE(foo)

foo <- function(){
  warning("oops")
  log("a")
}

withWE(foo)

aravind-j/viabilitymetrics documentation built on May 15, 2021, 9:10 a.m.