I have a larger dataset but this will also do to help me out. What i want to do is sum the values of y based on whether the values of x increases on decreases.
x<-c(1,