mutate_cond: Conditional Mutate (dplyr) rows that match a specified...

View source: R/mutate_cond.r

mutate_condR Documentation

Conditional Mutate (dplyr) rows that match a specified condition

Description

Mutate rows that match a specified condition, when using dplyr.

Usage

mutate_cond(.data, condition, ..., envir = parent.frame())

Arguments

.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

Value

the dataset with the conditional mutation

Examples

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)

qPharmetra/qpToolkit documentation built on May 24, 2023, 8:52 a.m.