Description Usage Arguments Details Examples
When using ifelse, the return values are evaluated for all values, then discarded. This causes problems when you want to check for valid inputs in test. In this function, values are only evaluated when necessary: yFun is called with yIn for test==TRUE, and nFun is called with nIn for test==FALSE. Missing (NA) values in test return NA, without calling either yFun or nFun
1 | Lazyifelse(test, yFun, yIn, nFun, nIn)
|
test |
an object which can be coerced to logical |
yFun, nFun |
Functions to be called when test evaluates to TRUE or FALSE respectively |
yIn, nIn |
Arguments for yFun and nFun. Recycled if necessary |
If you just want to return values, you can use the function identity
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.