Evaluate each of a set of logical conditions
within a data frame
x
. This is an internal utility function, not intended to be called
directly by package users.
eval_conditions(x, conditions, NA_condition_value=TRUE)
Logical matrix with one row for each row of x
and one column for
each condition in conditions
. Element [i, j]
contains the
result of evaluating condition[j]
for the i
-th row of
x
.
A data frame.
Character vector. Each element should represent an expression that can be
evaluated within x
, and produce a logical scalar or a vector with
one value per row of x
. Elements of conditions
that are NA
or the empty string are treated specially, via NA_condition_value
.
Logical scalar, TRUE, FALSE, or NA. The value to use in place of
evaluation when an element of conditions
is NA or the empty string.
Each condition should generally represent an expression involving columns
of x
. It is evaluated using x
as the environment, and must
return either a logical vector with length equal to the number of rows in
x
, or a logical scalar (which will be replicated into a vector of
the right length). The resulting vectors, one per condition, form the
columns of the returned matrix.
A condition may be NA or the empty string. In that case it is not
evaluated, and a vector containing NA_condition_value
is used
instead.