In my first column I have numeric identifiers and the second column is a character column that, for example, identifies the subject's favorite sports.
X1 X2
001 NBA
001 MLS
001 MLB
002 UFC
002 NFL
002 NHL
002 NBA
003 MLB
003 NBA
I have thousands of data points like this and I want the output to be able to show me the unique values in column 2 (X2) if the value in column 1 (X1) is equal to 001 or 002 or 003.
aggregate(X2~X1, df, function(x) toString(unique(x)))? - Ronak Shah