compare_byname: Compare matrix entries to a value

View source: R/Unary.R

compare_bynameR Documentation

Compare matrix entries to a value

Description

Compares matrix entries to a value, returning a matrix of same size as a containing TRUE or FALSE values as the result of applying compare_fun and val to all entries in a.

Usage

compare_byname(a, compare_fun = c("==", "!=", "<", "<=", ">=", ">"), val = 0)

Arguments

a

a matrix or list of matrices whose values are to be counted according to compare_fun

compare_fun

the comparison function, one of "==", "!=", "<", "<=", ">=", or ">". Default is "==".

val

a single value against which entries in matrix a are compared. Default is 0.

Value

a logical matrix of same size as a containing TRUE where the criterion is met, FALSE otherwise

Examples

m <- matrix(c(0, 1, 2, 3, 4, 0), nrow = 3, ncol = 2)
compare_byname(m, "<", 3)
compare_byname(list(m,m), "<", 3)

matsbyname documentation built on April 2, 2022, 1:06 a.m.