I shortly asked the following question:
Keep rows of data frame that match certain criteria
I was wondering if it is possible to expand the code provided to say, for instance, give me only those rows where a number in column b appears in at least X out of the 4 letters A,B,C and D? So for instance, the number 5 appears in column a in B,C,D but not in A. However, I would like to return all rows where the number appears in at least 2 out of the 4 letters. That means, the number 5 should be kept plus of course all numbers that appear in all letters. Hope it is clear what I am trying to say.
Many thanks in advance!
I find my solution quite easy to expand: