Learn R Programming

tidyfst (version 0.7.7)

mutate_when: Conditional update of columns in data.table

Description

Integrate mutate and case_when in dplyr and make a new tidy verb for data.table.

Usage

mutate_when(data, ...)

Arguments

data

data.frame

...

the first argument (contents before the first comma) should be the condition, other should be equation(s) just like `mutate_dt`.

Value

data.table

See Also

case_when

Examples

Run this code
# NOT RUN {
iris[3:8,]
iris[3:8,] %>%
  mutate_when(Petal.Width == .2,
              one = 1,Sepal.Length=2)
# }

Run the code above in your browser using DataLab