I'm trying to create a column that ranks each person based on their date of entry, but since everyone's date of entry is unique, it's been challenging.
here's a reprex:
df <- data.frame(
unique_id = c(1, 1, 1, 2, 2, 3, 3, 3),
date_of_entry = c("3-12-2001", "3-13-2001", "3-14-2001", "4-1-2001", "4-2-2001", "3-28-2001", "3-29-2001", "3-30-2001"))
What I want:
df_desired <- data.frame(
unique_id = c(1, 1, 1, 2, 2, 3, 3, 3),
date_of_entry = c("3-12-2001", "3-13-2001", "3-14-2001", "4-1-2001", "4-2-2001", "3-28-2001", "3-29-2001", "3-30-2001"),
day_at_facility = c(1, 2, 3, 1, 2, 1, 2, 3))
basically, i want to order the days at facility, but I need it to restart based on each unique ID. let me know if this is not clear.