# NOT RUN {
# group by Species in iris data set
as.data.table(iris) -> a
key(a)
group_by_dt(a,Species,inplace = FALSE)
key(a)
# use inplace operation to group by reference
as.data.table(iris) -> a
key(a)
group_by_dt(a,Species,inplace = TRUE)
key(a)
# aggregation after grouping using group_exe_dt
as.data.table(iris) -> a
a %>%
group_by_dt(Species) %>%
group_exe_dt(head(1))
a %>%
group_by_dt(Species) %>%
group_exe_dt(
head(3) %>%
summarise_dt(sum = sum(Sepal.Length))
)
# }
Run the code above in your browser using DataLab