i am working with a huge dataset that have ids and time. Let's say I want to select ids that appear at least two times at month 1 and 2 (in actual data I want to select ids if they appear at least 15 times in specified month). How can I accomplish this in R. Here is the dataset
df <- data.frame(id = c(1,1,1,1,1,2,2,2,2,3,3,3),
month = c(1,1,1,2,2,1,1,2,2,2,3,3))
here is what i want
df_1 <- data.frame(id = c(1,1,1,1,1,2,2,2,2),
month = c(1,1,1,2,2,1,1,2,2))
Thanks in advance!