no R (rstudio)
I have a vector v1 <- c(543, 543, 543, 675, 675, 675, 675, 22, 22, 22, 90, 90, 87, 876, 867)
.
I would like to get a vr
vector that represents the count of v1
(increasing 1:n
) of the numbers that repeat.
In relation to the previous vector ( v1
) for example: vr <- c(1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 1, 1, 2)
.
Thanks in advance!