If I have understood what you mean, you can use the (surely non-optimal) code:
#build a matrix .... A<-matrix(1:20,nrow=5) A[2,4]<-NA A[,3]<-rep(NA,nrow(A)) #count the missing value in each column fi<-apply(A,2,function(x)sum(is.na(x))) #exclude column(s) having a number of NA equal to nrow(A). Of course you can modify the "==" as well as "nrow(A)" A1<-A[!which(fi==nrow(A)),] Hope this help you best, vito ----- Original Message ----- From: antonio rodriguez <[EMAIL PROTECTED]> To: R-help <[EMAIL PROTECTED]> Sent: Friday, September 19, 2003 11:58 AM Subject: [R] extracting columns with NA's > Hi All, > > How do I can delete from a matrix (or array) only those columns which have > all their values set to NA? > > Cheers > > Antonio Rodriguez > --- > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help