mutate_dt: Mutate columns in data.frame

Description Usage Arguments Value See Also Examples

View source: R/mutate_dt.R

Description

Analogous function for mutate in dplyr.This is a little different from dt_mutate,because it prohibit the in place replacement.

Usage

1

Arguments

data

data.frame

...

List of variables or name-value pairs of summary/modifications functions.

by

unquoted name of grouping variable of list of unquoted names of grouping variables. For details see data.table

Value

data.table

See Also

mutate,dt_mutate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
iris %>% mutate_dt(one = 1)
mtcars  %>%
  head(3) %>%
  mutate_dt(
    cyl2 = cyl * 2,
    cyl4 = cyl2 * 2
  )

# window functions are useful for grouped mutates
iris %>%
  mutate_dt(
    rank = rank(-Sepal.Length, ties.method = "min"),
    keyby = Species)

hope-data-science/tidydt0 documentation built on Feb. 3, 2020, 12:04 a.m.