File: unmatrix.Rd

package info (click to toggle)
gregmisc 2.0.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,712 kB
  • ctags: 379
  • sloc: perl: 5,142; asm: 127; sh: 30; makefile: 17
file content (37 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
\name{unmatrix}
\alias{unmatrix}
\title{Convert a matrix into a vector, with appropriate names}
\description{
  Convert a matrix into a vector, with element names constructed from
  the row and column names of the matrix.
}
\usage{
unmatrix(x, byrow=FALSE)
}
\arguments{
  \item{x}{matrix}
  \item{byrow}{Logical. If \code{FALSE}, the elements within columns will be
    adjacent in the resulting vector, otherwise elements within rows
    will be adjacent.}
}
\value{
  A vector with names constructed from the row and column names from the
  matrix. If the the row or column names are missing, ('r1', 'r2', ..,) or
  ('c1', 'c2', ..) will be used as appropriate.
}
\author{Gregory R. Warnes \email{gregory\_r\_warnes@groton.pfizer.com} }
\seealso{ \code{\link[base]{as.vector}} }
\examples{
# simple, useless 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)
}
\keyword{manip}