Reduce() is much nicer, but I usually use

rowSums(A) > 0 for 'or', and
rowSums(A) == ncols for 'and'.

Which works slightly faster.

I noticed, though, that Reduce() doesn't work on matrices. Is there an
alternative for matrices, or do you have to convert the matrix first to a
data.frame, and then use Reduce?


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Using-apply-for-logical-conditions-tp2310929p2310991.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.

Reply via email to