I have this dataframe df as an example
`df = data.frame(x = c(rep(1,5),rep(2,5)),
y = 1:10,
z = 11:20,
n = 21:30)
I wish to sum the column y and z based on the groups of x while the column n stays the same with no changes. The desired output is as follows
x y z n
1 1 15 65 21
2 1 15 65 22
3 1 15 65 23
4 1 15 65 24
5 1 15 65 25
6 2 40 90 26
7 2 40 90 27
8 2 40 90 28
9 2 40 90 29
10 2 40 90 30