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
#> sum avg #> <num> <num> #> 1: 876.5 5.843333#> Species avg #> <fctr> <num> #> 1: setosa 5.313636 #> 2: versicolor 5.997872 #> 3: virginica 6.622449a %>% summarise_vars(is.numeric, min, by = Species)#> Species Sepal.Length Sepal.Width Petal.Length Petal.Width #> <fctr> <num> <num> <num> <num> #> 1: setosa 4.3 2.3 1.0 0.1 #> 2: versicolor 4.9 2.0 3.0 1.0 #> 3: virginica 4.9 2.2 4.5 1.4