I am trying to group some rows summing the values of one of the columns. In the example I want to sum votes by districts and parties. My goal is to group municipalities and get party votes within a district. I guess it is very easy but my attempts with aggregate and group_by have not worked so far. Thank you!
df <- structure(list(municip = c("A", "A", "A", "B", "B", "C", "C"), 
                               district = c("one", "one", "one", "one", "one", "two", "two"
                               ), party = c("green", "blue", "red", "green", "blue", "green", 
                                            "blue"), votes = c(10, 20, 10, 40, 30, 20, 10)), row.names = c(NA, 
                                                                                                           -7L), class = c("tbl_df", "tbl", "data.frame"))

