Consider the following data frame:
d <- data.frame(a = c(01,02,01),
b = c(101,101,101),
c = c(101,147,101),
d = c(100,200,500))
I want to merge the rows after column c, if the first three cell is equal. That is, I want to get the final data frame:
a b c d
1 01 101 101 600
2 02 101 147 200
That is, the value for column d has been merged for row 1 and 3, since they have the same value for the first three cell. How do I do that in R?