| sparse2full | R Documentation |
Modifies the input sparse form matrix into its full form.
The sparse form has three columns per line, corresponding to the set:
Row, Col, Value, and is defined by a lower triangle row-wise
of the full matrix and is sorted as columns within row.
Individual names should be assigned as attributes: attr(K, "rowNames")
and attr(K, "colNames"). If these are not provided they are considered
as 1 to n.
sparse2full(K = NULL)
K |
A square matrix in sparse form (default = |
Based on a function from ASReml-R 3 library by Butler et al. (2009).
A full square matrix where individual names are assigned to
rownames and colnames.
If attribute INVERSE is found this is also passed to the full matrix.
Butler, D.G., Cullis, B.R., Gilmour, A.R., and Gogel, B.J. 2009. ASReml-R reference manual. Version 3. The Department of Primary Industries and Fisheries (DPI&F).
# Get G matrix.
Gsp <- G.matrix(M = geno.apple, method = "VanRaden", sparseform = TRUE)$G.sparse
head(Gsp)
head(attr(Gsp, "rowNames"))
# Transform into full matrix.
G <- sparse2full(K = Gsp)
G[1:5, 1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.