mutate_cond | R Documentation |
Mutate rows that match a specified condition, when using dplyr.
mutate_cond(.data, condition, ..., envir = parent.frame())
.data |
dataset to perform opertaion |
condition |
condition to |
... |
The mutate argument to execute over |
envir |
environment - this parameter is best left alone, as the default setting allows use as standalone as well as in piping calls |
the dataset with the conditional mutation
library(magrittr)
library(dplyr)
nmData = example.NONMEM.dataset() %>%
mutate(CMT = swap(EVID, 0:1, 2:1)) %>%
mutate_cond(condition = CMT>1
, CMT = 99
)
tbl_df(nmData)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.