I got some data such as this
structure(list(id = c(1, 1, 1, 2, 2, 2, 3, 3, 3), values = c(12,
13, 13, 6, 5, 7, 8, 8, 8)), class = "data.frame", row.names = c(NA,
-9L))
I want something like this
structure(list(id2 = c(1, 1, 1, 2, 2, 2, 3, 3, 3), values2 = c(12,
13, 13.5, 6, 6.5, 7, 8, 8.5, 9)), class = "data.frame", row.names = c(NA,
-9L))
I want to check if they values in the values column for each ID are in increasing.If two values are equal then increase the second value by 0.5. Similary if the next value is smaller increase it by o.5.