A conditional mutate function that allows you to mutate a variable based on another

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

Arguments

.data,

the data frame or tibble you want to mutate a column in

x

The column you want to test for a logical condition

y

The coloumn you want to mutate based on logic from column x

Examples

mutate_cond(df, x == 1, y == "c" )
#> Error in eval(substitute(condition), .data, envir): invalid 'envir' argument of type 'closure'