Flexible ifelse Like Functionality for Arguments

Usage

IE(input, out1, out2 = NULL, FUN = is.numeric)

Arguments

input
An object to be tested.
out1
The output if test is TRUE.
out2
The output if test is FALSE.
FUN
A function that results in a logical output.

Value

Returns output 1 (out1) or output 2 (out2) as a function of the logical test.

Description

Use in the place of ifelse for arguments (particularly if NULL is an option).

Examples

IE(25, 360)
[1] 360
IE("char", 360)
NULL
IE(NULL, 360)
NULL
IE(NULL, 360, FUN = is.null)
[1] 360