I have the following data.frame
x y
1 t1 5
2 t2 2
3 t2 7
4 t3 9
5 t1 6
how add a column with the occurence number of the value in the first column like below ?:
x y occ
1 t1 5 1
2 t2 2 1
3 t2 7 2
4 t3 9 1
5 t1 6 2
Not 100% sure but is this what you mean?