Skip to content
Prev 325386 / 398503 Next

find the position of first observation for each subject

I would typically use rle() for this kind of thing:
[1] 1 4 9


It does assume that all rows for each unique value of id are grouped
together, but does not require that the rows be sorted by id.

-Don