Re: [R] Remove empty levels in subset

2012-06-26 Thread svo
Thank you very much. The advice I followed (and which, for some reason, I do not see here right now) was to use 'droplevels'. I needed the command for several variables at the same time, so this was very convenient. > Hello, Have you tried 'droplevels': test <-data.frame(a=as.factor(rep(c("f1","f

Re: [R] Remove empty levels in subset

2012-06-26 Thread svo
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.lis