Drop unused factor levels in a subsetted data frame April 24, 2022 by Tarik Since R version 2.12, there’s a droplevels() function. levels(droplevels(subdf$letters))