Say I'm using R and have a data table:
x <- data.table(V1 = c("A","A","A","B","B","C","D"))
table(x)
gives the following:
A B C D
3 2 1 1
How do I extract the items which occur over n times? For example, the output should be "A" if n = 2, and "A" and "B" if n = 1, and "A", "B", "C" if n = 0.