| maxCol | R Documentation |
Find column or row indices of maximum values in matrices. Works in a
similar way as base::max.col() but without conversion of sparse matrices
to dense matrices.
maxCol(x, ties_method = c("random", "first", "last"), use_nan = FALSE)
maxRow(x, ties_method = c("random", "first", "last"), use_nan = FALSE)
x |
a base::matrix or Matrix::Matrix object. |
ties_method |
specify how to handle ties. If "random", choose an index randomly within the ties; if "first" or "last" returns the index of the first or the last tie elements, respectively. |
use_nan |
if |
an integer vector
mt <- Matrix::rsparsematrix(100, 100, 0.9)
maxCol(mt, ties_method = "first")
max.col(mt, ties.method = "first") # the same
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.