Ended up working as follows:

dbs3.train.sans.influential.obs <-
drop.levels(dbs3.train.sans.influential.obs)

drop.list <- NULL
for (i in 4:ncol(dbs3.train.sans.influential.obs)) {       
     if (nlevels(dbs3.train.sans.influential.obs[,i]) < 2) {drop.list <-
cbind(drop.list,i)}}

dbs3.train.sans.influential.obs <-
dbs3.train.sans.influential.obs[-c(drop.list)]
-- 
View this message in context: 
http://r.789695.n4.nabble.com/REmove-level-with-zero-observations-tp2312553p2312821.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

Reply via email to