I have simplified the two datafrfames:
a = data.frame(ID = c("1", "2", "3", "4", "5"))
b = data.frame(ID = c("1", "1", "6", "7", "8", "8", "3"))
How do I filter data frame b with the matching values in a so only the values of 1:5 will remain in b? So only 1, 1, and 3 will remain in b?