I am trying to find Percent change to 2 successive values.
df = data.frame(k = c(2,3,4,5,6,7,8,9,10,11,12,13,14,15),
rmse = c(61.41,58.7,56.84,55.6,54.61,53.98,53.5,53.04,52.66,52.39,52.19,52.04,51.9,51.8))
I want another column with percent change calculated for two succesive values. For example: The percent change for K= 4 should be calculated with K =2, similarly K = 5 with K= 3 and so on.
I hope i am clear. Anybody got an idea on how to solve this?
