mutate_when: Conditional update of columns in data.table

Description Usage Arguments Value See Also Examples

View source: R/mutate_when.R

Description

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

Usage

1

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

1
2
3
4
iris[3:8,]
iris[3:8,] %>%
  mutate_when(Petal.Width == .2,
              one = 1,Sepal.Length=2)

hope-data-science/tidydt documentation built on Feb. 21, 2020, 10:25 a.m.