esac: Sequential ifelse with paired arguments

View source: R/misc.R

esacR Documentation

Sequential ifelse with paired arguments

Description

Equivalent of nested ifelse with alternating conditions and values

Usage

esac(...)

Arguments

...

a sequence of alternating arguments with each pair consisting of a vector logical argument followed by a vector of values to be returned in the positions in which the logical argument is TRUE. Each pair corresponds to the first two arguments of a ifelse. To get a default value, use a condition 'TRUE' for the last pair. You may also need to specify is.na(x) if there are NAs.

Value

a vector consisting of the value vector corresponding to the first logical vector that evaluates to TRUE in a position.


gmonette/spida2 documentation built on Aug. 11, 2024, 7:52 p.m.