In R i have a vector where always each five consecutive elements are equal
v=(a, a, a, a, a, a, b, b, b,
b, b....)
I want to multiplicate it with values from [0.99,1.01] because I want a slight variation over the entries but the mean has to stay the same as before, i.e the mean of the first 5 entries of the new vector has also to be a
I would prefer it if the values from [0.99,1.01] are randomly chosen (with runif for example) , but deterministic would also be okay, if it would be too complicated to achive the condition with random numbers.
Would really appreciate any kind of help