eval_conditions {tablesgg} | R Documentation |
Evaluate a Set of Logical Conditions Within a Data Frame
Description
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.
Usage
eval_conditions(x, conditions, NA_condition_value=TRUE)
Arguments
x |
A data frame. |
conditions |
Character vector. Each element should represent an expression that can be
evaluated within |
NA_condition_value |
Logical scalar, TRUE, FALSE, or NA. The value to use in place of
evaluation when an element of |
Details
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.
Value
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
.