sm2list: Converts a sparse matrix into a three column format.

View source: R/sm2list.R

sm2listR Documentation

Converts a sparse matrix into a three column format.

Description

From a sparse matrix object, the three column, row ordered lower triangle of non-zero elements is created. Mostly used within other functions (i.e., makeD)

Usage

sm2list(A, rownames = NULL, colnames = c("row", "column", "A"))

Arguments

A

a sparse matrix

rownames

a list of rownames from the 'A' matrix.

colnames

the columns will be labeled however they are entered in this character vector

Details

The sparse matrix and three column format must fit CERTAIN assumptions about row/column sorting and lower/upper triangle matrix.

Adapted from a function in the MCMCglmm package

Value

returns the list form of the sparse matrix as a data.frame

See Also

MCMCglmm


nadiv documentation built on Dec. 8, 2022, 1:11 a.m.