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)
a b
f1:10 Min. :1
f2:10 1st Qu.:1
f3:10 Median :2
Mean :2
3rd Qu.:3
Max. :3
> test2 <- subset(test,test$a=="f1")
> summary(test2)
a b
f1:10 Min. :1
f2: 0 1st Qu.:1
f3: 0 Median :1
Mean :1
3rd Qu.:1
Max. :1
Look that the f2 and f3 are in the new table, how to remove all empty
levels?
Thanks
Ronaldo
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.