How do I keep every ID which meet a condition at least once?
I have a df with repeated measurements. Now i want to keep all rows of the individuals that meet a condition at least once. I tried a dplyr group_by but i always only end up with the rows that fulfill the condition and loose all other measurements of that individual.
dat2 <- dat1 %>%
group_by(id) %>%
filter(category=="blood") %>%
ungroup()
Thanks in advance!