How-to: dropping factor levels in a subsetted data frame in R #fix #it #programming
How-to: dropping factor levels in a subsetted data frame in R #fix #itĀ #programming
dropping factor levels in a subsetted data frame in R
I have a data frame containing a factor. When I create a subset of this data frame using subset() or another indexing function, a new data frame is created. However, the factor variable retains all of its original levels even when they do not exist in the new data frame.
This creates headaches when doing faceted plotting or using functionsā¦
View On WordPress












