Say I have a long form data frame, of time series data, basically. It's going to look like this. Somewhere along my conversion of raw data the numbering got lost, and so I'd like to get back a column of frame numberings (starting from 1).
The $frame
column is my desired output.
Edit: Newly added NaN
values in my example, see comments below. Also changed title of question to reflect this specifically.
name value frame
A 41 1
A NaN 2
A 72 3
B 24 1
B 51 2
C 28 1
C NaN 2
C 57 3
C NaN 4
C 34 5
D 24 1
D 75 2