matrixIndex | R Documentation |
Convert matrix element index to row/column coordinate or vice-versa
matrixIndex(idx = NULL, coord = NULL, dim.mat = NULL)
idx |
numeric. Index of a matrix element |
coord |
numeric vector or matrix. Coordinate of an index (row,col) |
dim.mat |
numeric vector. Dimensions of matrix (rows, ncols) |
either a vector (indices) or matrix (coordinate) element
M <- matrix(1:20, 4,5) M matrixIndex(idx = 15, dim.mat = dim(M)) matrixIndex(coord = c(3,4), dim.mat = dim(M)) matrixIndex(coord = matrix(c(3,4,4,5), ncol=2, byrow=TRUE), dim.mat = dim(M))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.