How about: remove.constant.values<-function(x,MARGIN,value2remove) { is.constant.line<-function(x,value2remove) { return(any(x!=value2remove)) } return(unlist(apply(x,MARGIN,is.constant.line,value2remove))) }
x[,remove.constant.values(x,2,0)] Jim ______________________________________________ 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.