Learn R Programming

tidyfst (version 0.7.7)

summarise_dt: Summarise columns to single values

Description

Analogous function for summarise in dplyr.

Usage

summarise_dt(data, ..., by = NULL)

summarize_dt(data, ..., by = NULL)

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

summarise

Examples

Run this code
# NOT RUN {
iris %>% summarise_dt(avg = mean(Sepal.Length))
iris %>% summarise_dt(avg = mean(Sepal.Length),by = Species)
mtcars %>% summarise_dt(avg = mean(hp),by = .(cyl,vs))

# the data.table way
mtcars %>% summarise_dt(cyl_n = .N, by = .(cyl, vs)) # `.`` is short for list



# }

Run the code above in your browser using DataLab