unmatrix.html 1.86 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Convert a matrix into a vector, with appropriate names</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>

<table width="100%" summary="page for unmatrix {gdata}"><tr><td>unmatrix {gdata}</td><td align="right">R Documentation</td></tr></table>
<h2>Convert a matrix into a vector, with appropriate names</h2>


<h3>Description</h3>

<p>
Convert a matrix into a vector, with element names constructed from
the row and column names of the matrix.
</p>


<h3>Usage</h3>

<pre>
unmatrix(x, byrow=FALSE)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
matrix</td></tr>
<tr valign="top"><td><code>byrow</code></td>
<td>
Logical. If <code>FALSE</code>, the elements within columns will be
adjacent in the resulting vector, otherwise elements within rows
will be adjacent.</td></tr>
</table>

<h3>Value</h3>

<p>
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.</p>

<h3>Author(s)</h3>

<p>
Gregory R. Warnes <a href="mailto:warnes@bst.rochester.edu">warnes@bst.rochester.edu</a>
</p>


<h3>See Also</h3>

<p>
<code><a href="../../base/html/as.vector.html">as.vector</a></code>
</p>


<h3>Examples</h3>

<pre>
# simple, useless example
m &lt;- matrix( letters[1:10], ncol=5)
m
unmatrix(m)

# unroll model output
x &lt;- rnorm(100)
y &lt;- rnorm(100, mean=3+5*x, sd=0.25)
m &lt;- coef( summary(lm( y ~ x )) )
unmatrix(m)
</pre>



<hr><div align="center">[Package <em>gdata</em> version 2.3.1 <a href="00Index.html">Index]</a></div>

</body></html>