For a given vector, a user is running a for loop but gets an error as follows.
vector=c(1,1,1,1,1,3,3,5,11,18 ....1350)
The error is
In 1:levels_id : numerical expression has 1350 elements: only the first used
The error occured because looping over the index is done instead of looping over the element. To loop over the element, we can use the following
for(i in 1:length(unique(vector))){
this.vector <- unique(vector)[i]
}