Hello, > I could find the maximal set of columns such that there exists a subset of > rows with non NA values for every column in the set - what is an > efficient > way to do that?
Try 'na.exclude' on the transpose matrix. Example: set.seed(1) x <- matrix(1:200, ncol=25) f <- function(x){x[sample(length(x), 1)] <- NA; x} x <- t(apply(x, 1, f)) x x.without.NA <- t(na.exclude(t(x))) Hope this helps, Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/Principal-Components-for-matrices-with-NA-tp4425930p4426040.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.