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 Sarah Goslee
Hi, On Tue, Jun 26, 2012 at 8:06 AM, svo wrote: > 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

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

Re: [R] Remove empty levels in subset

2008-11-10 Thread Ronaldo Reis-Jr.
Thanks it work perfectly. 2008/11/10 Henrique Dallazuanna <[EMAIL PROTECTED]> > Try this: > > test2$a <- factor(test2$a) > > On Mon, Nov 10, 2008 at 10:33 AM, Ronaldo Reis-Jr. <[EMAIL PROTECTED]>wrote: > >> Hi, >> >> when I use use subset in a data.frame, all empty levels are maintained in >> th

Re: [R] Remove empty levels in subset

2008-11-10 Thread Henrique Dallazuanna
Try this: test2$a <- factor(test2$a) On Mon, Nov 10, 2008 at 10:33 AM, Ronaldo Reis-Jr. <[EMAIL PROTECTED]>wrote: > Hi, > > when I use use subset in a data.frame, all empty levels are maintained in > the new table. > > > test <- > data.frame(a=as.factor(rep(c("f1","f2","f3"),10)),b=rep(c(1,2,3)

[R] Remove empty levels in subset

2008-11-10 Thread Ronaldo Reis-Jr.
Hi, when I use use subset in a data.frame, all empty levels are maintained in the new table. > test <- data.frame(a=as.factor(rep(c("f1","f2","f3"),10)),b=rep(c(1,2,3),10)) > summary(test) ab f1:10 Min. :1 f2:10 1st Qu.:1 f3:10 Median :2 Mean :2 3rd Q