> Hi, I have a problem regarding matrix handeling. I am working with > a serie of matrixes containing several columns. Now I would like to > delete those rows of the matrixes,that in one of the columns contain > values less than 50 or greater than 1000.
Try this: m <- matrix(runif(150, 0, 1050), nrow=10); m cols.to.remove <- apply(m, 2, function(x) any(x < 50 | x > 1000)) m[,!cols.to.remove] It's well worth learning how to use apply, and its variants (tapply, sapply etc.); they come in very useful. Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} ______________________________________________ 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.