Analogous function for mutate
and transmute
in dplyr.
mutate_dt(data, ...) transmute_dt(data, ...)
data | data.frame |
---|---|
... | List of variables or name-value pairs of summary/modifications functions. |
data.table
iris %>% mutate_dt(one = 1,Sepal.Length = Sepal.Length + 1)#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species one #> 1: 6.1 3.5 1.4 0.2 setosa 1 #> 2: 5.9 3.0 1.4 0.2 setosa 1 #> 3: 5.7 3.2 1.3 0.2 setosa 1 #> 4: 5.6 3.1 1.5 0.2 setosa 1 #> 5: 6.0 3.6 1.4 0.2 setosa 1 #> --- #> 146: 7.7 3.0 5.2 2.3 virginica 1 #> 147: 7.3 2.5 5.0 1.9 virginica 1 #> 148: 7.5 3.0 5.2 2.0 virginica 1 #> 149: 7.2 3.4 5.4 2.3 virginica 1 #> 150: 6.9 3.0 5.1 1.8 virginica 1iris %>% transmute_dt(one = 1,Sepal.Length = Sepal.Length + 1)#> one Sepal.Length #> 1: 1 6.1 #> 2: 1 5.9 #> 3: 1 5.7 #> 4: 1 5.6 #> 5: 1 6.0 #> --- #> 146: 1 7.7 #> 147: 1 7.3 #> 148: 1 7.5 #> 149: 1 7.2 #> 150: 1 6.9