I am trying to create a numerical sequence in R that looks like this:
ID|class|counter
A| z| 1
A| z| 2
A| c| 1
A| c| 2
A| z| 3
B| z| 1
B| c| 1
B| c| 2
So the Id is unique and I want to know which order each observation is in given their class. I am trying to count the inner class-Id combination. How does one do this?