[R] Subset doesn't drop unused factor levels

hadley wickham h.wickham at gmail.com
Thu Oct 7 19:27:29 CEST 2004


a <- data.frame(b = rep(1:5, each=2), c=factor(rep("a",10), levels=c("a","b")))
levels(subset(a, b=1, drop=T)$c)
# [1] "a" "b"

Is this a bug?

Thanks,,

Hadley




More information about the R-help mailing list