| c_ListofMatrixRows | R Documentation |
Convert a matrix into list of row vectors
c_ListofMatrixRows(object)
object |
An integer, numeric, character or logical matrix of N rows and M columns |
Typically this will be for 3D coordinates but there are no limits on row length.
a list containing N vectors of length M corresponding to the rows of
object.
## Not run:
library(nat)
xyz=xyzmatrix(Cell07PNs)
mat2list = function(m) {
um=unname(m)
lapply(1:nrow(um), function(i) um[i,])
}
bench::mark(rcpp=c_ListofMatrixRows(xyz), r=mat2list(xyz))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.