adam.888
adam.888

Reputation: 7846

R making a list of factors in a dataframe column

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

Answers (1)

IRTFM
IRTFM

Reputation: 263332

levels(factor(df$col))  

OR:

unique(df$col)

Or even:

names(table(df$col))

Upvotes: 27

Related Questions