powered by
Convert a matrix into list of row vectors
c_ListofMatrixRows(object)
a list containing N vectors of length M corresponding to the rows of
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.
if (FALSE) { 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)) }
Run the code above in your browser using DataLab