I have example data as follows:
mtcars <- mtcars
# Creates a factor with one level
mtcars$vs <- 1
mtcars$vs <- as.factor(mtcars$vs)
# Creates a factor with 2 levels
mtcars$am <- as.factor(mtcars$am)
I would like to simply get the names of all factors with more than one level, so:
names_of_factors_with_more_lvls <- "am"
What is the shortest way to achieve this?