c_ListofMatrixRows: Convert a matrix into list of row vectors

View source: R/RcppExports.R

c_ListofMatrixRowsR Documentation

Convert a matrix into list of row vectors

Description

Convert a matrix into list of row vectors

Usage

c_ListofMatrixRows(object)

Arguments

object

An integer, numeric, character or logical matrix of N rows and M columns

Details

Typically this will be for 3D coordinates but there are no limits on row length.

Value

a list containing N vectors of length M corresponding to the rows of object.

Examples

## 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)

natcpp documentation built on Sept. 26, 2026, 9:06 a.m.