Reputation: 7846
Suppose I have a column in a dataframe:
A A A A B B B B B B B B B C C D D E E E E E E E E E F F F F F F F F F
How can I make a list of the factors within that column? ie:
A B C D E F
Thank you for your help.
Upvotes: 10
Views: 25987
Reputation: 263332
levels(factor(df$col))
OR:
unique(df$col)
Or even:
names(table(df$col))
Upvotes: 27