I have a data frame like this:
x <- data.frame(
name = rep(letters[1:4], each = 2),
value = c(2,10,4,20,8,40,20,100)
)
I want to group by name, then divide the bottom row by upper row.
result should look like:
name divideValue
1 a 5
2 b 5
3 c 5
4 d 5
Thank you!