Aggregate data using summary statistics
Aggregate data using summary statistics such as mean or median. Can be calculated by group.
summarize.(.df, ..., .by = NULL, .sort = FALSE) summarise.(.df, ..., .by = NULL, .sort = FALSE)
.df |
A data.frame or data.table |
... |
Aggregations to perform |
.by |
Columns to group by.
|
.sort |
experimental: Should the resulting data.table be sorted by the grouping columns? |
test_df <- data.table( a = 1:3, b = 4:6, c = c("a","a","b"), d = c("a","a","b") ) test_df %>% summarize.(avg_a = mean(a), max_b = max(b), .by = c) test_df %>% summarize.(avg_a = mean(a), .by = c(c, d))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.