[R] subset drop unused levels

Søren Merser merser at image.dk
Sun Jun 27 10:16:40 CEST 2004


hi there

tried to use subset with drop=TRUE, but all the 'old' levels are preserved,
i.e. when calling e.g. ftable a lot of zeros are displayed

>x<-subset(LREG,  (kir=='AA' | kir=='BB') & (type=='t1' | otype=='t2'),
drop=TRUE, select=c(event, kir, type))
> ftable(x)

i explicit have to call factor like
>ftable(event~factor(kir)+factor(type))

any hints?

regards soren




More information about the R-help mailing list