which0 {fntl} | R Documentation |
Matrix Which Function
Description
Matrix Which Function
Usage
which0(X, f)
Arguments
X |
A matrix |
f |
A predicate to apply to each element of |
Details
The which
C++ functions are intended to operate like the following call
in R.
which(f(X), arr.ind = TRUE) - 1
The R functions exposed here are specific to numeric-valued matrices, but the underlying C++ functions are intended to work with any type of Rcpp Matrix.
Value
A matrix with two columns. Each row contains a row and column index
corresponding to an element of X
that matches the criteria of f
.
See section "Which" of the package vignette for details.
Examples
X = matrix(1:12 / 6, nrow = 4, ncol = 3)
f = function(x) { x < 1 }
which0(X, f)
[Package fntl version 0.1.1 Index]