unmatrix {gdata} | R Documentation |
Convert a matrix into a vector, with element names constructed from the row and column names of the matrix.
unmatrix(x, byrow=FALSE)
x |
matrix |
byrow |
Logical. If |
A vector with names constructed from the row and column names from the matrix. If the row or column names are missing, ('r1', 'r2', ...,) or ('c1', 'c2', ...) will be used as appropriate.
Gregory R. Warnes greg@warnes.net
# Simple example
m <- matrix(letters[1:10], ncol=5)
m
unmatrix(m)
# Unroll model output
x <- rnorm(100)
y <- rnorm(100, mean=3+5*x, sd=0.25)
m <- coef(summary(lm(y ~ x)))
unmatrix(m)