summarise | R Documentation |
Create one or more scalar variables summarizing the variables of an existing data.table.
summarise(.data, ..., by = NULL)
summarise_when(.data, when, ..., by = NULL)
summarise_vars(.data, .cols = NULL, .func, ..., by)
.data |
A data.table |
... |
List of variables or name-value pairs of summary/modifications
functions for |
by |
Unquoted name of grouping variable of list of unquoted names of grouping variables. For details see data.table |
when |
An object which can be coerced to logical mode |
.cols |
Columns to be summarised. |
.func |
Function to be run within each column, should return a value or vectors with same length. |
A data.table
a = as.data.table(iris)
a %>% summarise(sum = sum(Sepal.Length),avg = mean(Sepal.Length))
a %>%
summarise_when(Sepal.Length > 5, avg = mean(Sepal.Length), by = Species)
a %>%
summarise_vars(is.numeric, min, by = Species)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.