I have a dataframe that looks something like this:
test <- data.frame(
ID = c(1001,1001,1002,1002,1003,1003,1003),
Complete = c(1, 1, 1, 1, 1, 1,1)
)
I want to create a column that logs the nth row of each ID in consecutive order. The output should look like this:
test <- data.frame(
ID = c(1001,1001,1002,1002,1003,1003,1003),
Day = c(1,2,1,2,1,2,3),
Complete = c(1, 1, 1, 1, 1, 1,1)
)
How can I do this?
Thank you!