I have a dataset looking at infections. I want my final dataset to have both people who have infections and did not have infections. But remove those whose infections developed past 1 year. For example:
Infection 0 = No 1 = Yes (SSI) | Time to Infection in Days(TTI) |
---|---|
0 | NA |
1 | 24 |
1 | 450 |
I am expecting this:
Infection 0 = No 1 = Yes (SSI) | Time to Infection in Days(TTI) |
---|---|
0 | NA |
1 | 24 |
When I run
dt_one_year <- dt %>% filter(TTI %in% 0:365)
It removes both row 1 and row 3, when I want it to keep row 1 and 2. Any ideas how to do this using dplyr?
Remove only if SSI = 1 and TTI > 365.