mutate a column within a dplyr pype only on a subset of rows specified by a condition Retrieved from a StackOverflow answer (https://stackoverflow.com/a/34170176/6871135)

pr_mutate_when(data, ...)

Arguments

data

a data.frame (or tibble or data.table)

...

expression to be evaluated to filter on rows

Value

data frame

Details

DETAILS

Examples

# NOT RUN {
 library(magrittr)
 mtcars %>% mutate_when(
            mpg > 22,    list(cyl = 100),
            disp == 160, list(cyl = 200))

# }