I am searching for a function that return a vector with the position/count of each value of a vector.
Here an example :
I have :
vec<-c("A","A","A","B","B","C")
I want :
c(1,2,3,1,2,1)
I have created a function that works but I am looking for a faster way to get it, as I have a big dataset.
Thank you very much in advance