I have a data frame in R with the first factor having 3 levels [A,B,C] and the second factor having 3 levels [1,2,3]. This results in the data frame.
Alphabet <- c ("A","A","A","B","B","B","C","C")
L <- c (1,2,1,1,3,1,3,3)
df = data.frame(Alphabet, L)
I want to subset the frame based on the criteria that if a level in Alphabet has a 3, then the row should be dropped. However, this should only happen if another observation at the same level has either a 1 or a 2 in there.
So in the above example row, 5 will be dropped because B is also associated with a 1 in rows 4 and 6. Rows 7 and 8 will not be dropped because C is not associated with either 1 or 2.