I have the following vector:
> a
[1] 64.42 66.99 100.39 97.96 97.96 96.26 94.22 92.35 86.05 84.01
I want you to be able to generate another vector that grows and decreases monotonically, whatever increment I choose. The output for this vector with the increment of 1 would be:
> b
[1] 1 2 3 2 1 -1 -2 -3 -4 -5
Ideally, you should not use a loop.