iif: Inline If Statement

Description Usage Arguments Value Examples

View source: R/Inline_If.R

Description

Inline if statement that checks the condition, and returns either the true or false paramater. Similar to ifelse, but returns the entire value of the parameters.

Usage

1
iif(condition, true, false)

Arguments

condition

Condition to check (logical).

true

Value to return when the condition is TRUE.

false

Value to return when the condition is FALSE.

Value

Either the true or false parameter.

Examples

1
2
3
4
5
6
7
iif(TRUE, "a", "b")
iif(10 < 20, TRUE, FALSE)
print(iif(TRUE, "true", "false"))

# Compare iif to ifelse
iif(TRUE, 1:2, 3:4)
ifelse(TRUE, 1:2, 3:4)

KO112/KO documentation built on Oct. 2, 2020, 9:21 a.m.