eval_conditions | R Documentation |
eval_conditions()
evaluates a set of conditions in the context of a
data frame and an optional environment.
The utility of this function is to provide an easy way to generate a logical
vector of matching records from a set of logical conditions involving
variables in a data frame (dat
) and optionally in a supplementary
environment (.env
). The set of logical conditions are provided as
expressions to be evaluated in the context of dat
and .env
.
Variables are looked up in dat
, then in .env
, then in the calling
function's environment, followed by its parent environments.
eval_conditions(dat, ..., .na = NA, .env = rlang::caller_env())
dat |
A data frame |
... |
A set of logical conditions, e.g. |
.na |
Return value to be used when the conditions evaluate to |
.env |
An optional environment to look for variables involved in logical
expression passed in |
A logical vector reflecting matching rows in dat
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.