colAny: Column and row-wise Any

View source: R/Any.R

Column and row-wise Any/AllR Documentation

Column and row-wise Any

Description

Column and row-wise Any/All of a matrix.

Usage

colAny(x)
rowAny(x)
colAll(x, parallel = FALSE, cores = 0)
rowAll(x, parallel = FALSE, cores = 0)

Arguments

x

A logical matrix with the data.

parallel

Do you want the computations to take place in parallel? The default value is FALSE.

cores

Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores.

Details

The functions is written in C++ in order to be as fast as possible.

Value

A vector where item "i" is true if found Any/All true in column/row "i". Otherwise false.

Author(s)

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

See Also

Median, colMedians, colMeans (buit-in R function)

Examples

x <- matrix(as.logical(rbinom(100*100,1,0.5)),100,100)
a<-colAny(x)
#b<-apply(x,2,any)
#all.equal(a,b)

a<-rowAny(x)
#b<-apply(x,1,any)
#all.equal(a,b)

a<-colAll(x)
#b<-apply(x,2,all)
#all.equal(a,b)

a<-b<-x<-NULL

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.