I have a dataset that has some ID and associated timepoints. I want to filter out IDs that have a specific combination of timepoints. If I filter using %in% or |, I get IDs out of the specific combination. How do I do this in R ?
| ID | Timepoint |
|---|---|
| 1 | 1 |
| 1 | 6 |
| 1 | 12 |
| 2 | 1 |
| 3 | 1 |
| 3 | 6 |
| 3 | 12 |
| 3 | 18 |
| 4 | 1 |
| 4 | 6 |
| 4 | 12 |
I want to filter IDs that have timepoints 1,6 and 12 and exclude other IDs.
Result would be IDs 1,3 and 4
Output: