Hi, I have exactly the same question (how to remove empty levels in my subset), but in my case the factor command does not work, because my dataframe is not atomic
Try this: test2$a <- factor(test2$a)
R gives me the error message: Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list? Do you have advice? Thank you -- View this message in context: http://r.789695.n4.nabble.com/Remove-empty-levels-in-subset-tp873967p4634499.html Sent from the R help mailing list archive at Nabble.com.