Column and row-wise Any
Column and row-wise Any/All of a matrix.
colAny(x) rowAny(x) colAll(x, parallel = FALSE) rowAll(x, parallel = FALSE)
x |
A logical matrix with the data. |
parallel |
Do you want the computations to take place in parallel? The default value is FALSE. |
The functions is written in C++ in order to be as fast as possible.
A vector where item "i" is true if found Any/All true in column/row "i". Otherwise false.
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
Median, colMedians, colMeans (buit-in R function)
x <- matrix(as.logical(rbinom(100*100,1,0.5)),100,100) system.time( a<-colAny(x) ) system.time( b<-apply(x,2,any) ) all.equal(a,b) system.time( a<-rowAny(x) ) system.time( b<-apply(x,1,any) ) all.equal(a,b) system.time( a<-colAll(x) ) system.time( b<-apply(x,2,all) ) all.equal(a,b) a<-b<-x<-NULL
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.