Apparently I am trying to subset my variable with positive and "negative indexes". However debugging the code, I can not why R studio is interpreting it as I am mixing negative and positive subsets.
Here is the part of the code:
if (stepcount > 192 | sum(na.omit(ppt[i-193:i-1])) < 0.6) {statement}
Error:
Error in ppt[i - 193:i - 1] :
only 0's may be mixed with negative subscripts
Debugging the code I see that my value for i at this point is 3572 which means nor negative subsetting in ppt[i - 193:i - 1]
If it helps, just some more information: if I use two "or" operator instead of one, like:
if (stepcount > 192 || sum(na.omit(ppt[i-193:i-1])) < 0.6) {statement}
I still get the same err but in i being 3603. Honestly I don't know the difference but may be it conveys some kind of information that could clarify the problem.
I think that this is probably a simple thing that I am not aware of and that the reproducible code would not be necessary (since it is a too long code to analyse a large data. However I could post it on, if you guys think that is necessary.