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)
Run the code above in your browser using DataLab