Hi,, Can I get help with this. I need to remove a column form the matrix if that specific column has his all entry zero, here the code I wrote but it is not working can you help me please
namVar <- c("TrlgWSST","TrlgWSSE","TrlgWSSR","SSdiff","TrlgWMSE","TrlgWR2","TrlgWR2adj","TrlgSSE","TrlgMSE","TrlgR2","TrlgR2adj","TrSSE","TrMSE","TrR2","TrR2adj","rdf2", "TelgSSE","TelgMSE","TelgR2","TelgR2adj","TelgWSSE","TelgWMSE" ,"TelgWR2","TelgWR2adj","TeSSE","TeMSE","TeR2","TeR2adj","edf2","Runtime") Asse <- matrix(0,nrow=5,ncol=length(namVar)) Asse[,1:3]<-2 Asse[2,4] <-2000 Asse[,5:10]<-3 Asse[,11:20]<-5 Asse[,21:30]<-12 if(all(Asse[,"SSdiff"]==0)==TRUE){ Asse <- Asse[,-which(colnames(Asse)%in%"SSdiff")]} -- View this message in context: http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334.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.