Best Answer · By JanBask Data Science Expert
Answered on Nov 29, 2019
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]
}