which0 | R Documentation |
Matrix Which Function
which0(X, f)
X |
A matrix |
f |
A predicate to apply to each element of |
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.
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.
X = matrix(1:12 / 6, nrow = 4, ncol = 3)
f = function(x) { x < 1 }
which0(X, f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.