assuming i have a dataframe that look like so:
category type
[1] A green
[2] A purple
[3] A orange
[4] B yellow
[5] B green
[6] B orange
[7] C green
How do I get a list containing those types that appear in each category? In this case it should look like:
type
[1] green
I know that this question is basic, and probably has been asked by someone else before; but my method is too long and I'm sure there's a more efficient way of doing it: I used to split the dataframe based on category, and do the set intersection. Is there a better way please? thanks!