condition_add | R Documentation |
condition_add()
tags records in a data set, indicating which rows match the
specified conditions, resulting in a conditioned data frame. Learn how to
integrate conditioned data frames in your SDTM domain derivation in
vignette("cnd_df")
.
condition_add(dat, ..., .na = NA, .dat2 = rlang::env())
dat |
A data frame. |
... |
Conditions to filter the data frame. |
.na |
Return value to be used when the conditions evaluate to |
.dat2 |
An optional environment to look for variables involved in
logical expression passed in |
A conditioned data frame, meaning a tibble with an additional class
cnd_df
and a logical vector attribute indicating matching rows.
(df <- tibble::tibble(x = 1L:3L, y = letters[x]))
# Mark rows for which `x` greater than `1`
(cnd_df <- condition_add(dat = df, x > 1L))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.