I would like to make groups with dplyr depending on a condition. For example, if we have the following table:
A B
1 0
10 1
5 1
6 2
I would make groups when B = 0, another when B > 1, another when B > 2, and so on. The following approximation is wrong but maybe helps to understand:
df %>%
group_by(B > 0:2) %>%
summarize(Total = sum(A))