[R] Using apply for logical conditions
Michael Lachmann
lachmann at eva.mpg.de
Mon Aug 2 23:08:37 CEST 2010
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.
More information about the R-help
mailing list