Here is an example data frame
ID Var1 Var2 Var3 ....... Var85
A 3 2 1 3
B 1 3 1 2
A 2 1 1 1
A 1 2 2 1
C 3 1 3 2
C 2 1 2 1
B 1 3 3 1
I want to create the following, basically summing up rows based on ID
ID Var1 Var2 Var3 ....... Var85
A 6 5 4 5
B 2 2 4 3
C 5 6 5 3
I found a solution for only a single variable using the dplyr, but I know how to implement that with multiple columns
df <- df %>% group_by(ID) %>% summarise(Var1 = sum(Var2)) %>% as.data.frame()
I thought of implementing the following via a loop, but I am hoping for a much simpler solution.