atOnlyIf
Evaluate an Expression Only If Condition Is TRUE

Description

atOnlyIf(cond,expr) returns the value of the evaluated expr if cond is TRUE, otherwise it returns TRUE. This is handy for tests that only make sense on certain platforms or for certain versions of R (or S+).

Usage

atOnlyIf(cond, expr)

Arguments

cond A scalar logical, TRUE or FALSE, to specify if the expression should be evaluated or not.
expr An expression.
Value
If cond is TRUE atOnlyIf returns the value of the evaluated expression. If FALSE it returns TRUE.
See Also
assertionTest
Examples
  atOnlyIf(.Platform$OS.type=="unix", unname(unix.time(Sys.sleep(5))[3]>4))
Package assertionTest version 6.0.0-69
Package Index