I have health data from a cohort study with repeated measures, where individuals are seen for multiple yearly follow-up visits. At baseline (visit 0), some individuals are already diagnosed with the disease of interest, while others aren't. As I'm looking at incident cases in my analysis, I need to remove those individual diagnosed as "sick" at visit 0 from my data. How might I do this in the tidyverse? I'm including an example below of the sort of data structure I'll be looking at:
subject_id <- c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5)
visit <- c(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3)
diagnosis <- c("not sick", "not sick", "not sick", "sick", "sick", "sick", "sick", "sick", "not sick", "not sick", "sick", "sick", "sick", "sick", "sick", "sick", "not sick", "not sick", "not sick", "sick")
cohort <- data.frame(subject_id, visit, diagnosis)
cohort