\HeaderA{unwrapdups}{Unwrap Duplicate Spot Values from Rows into Columns}{unwrapdups}
\keyword{array}{unwrapdups}
\begin{Description}\relax
Reshape a matrix so that a set of consecutive rows becomes a single row in the output.
\end{Description}
\begin{Usage}
\begin{verbatim}
unwrapdups(M,ndups=2,spacing=1)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{M}] a matrix.
\item[\code{ndups}] number of duplicate spots. The number of rows of M must be divisible by \code{ndups}.
\item[\code{spacing}] the spacing between the rows of \code{M} corresponding to duplicate spots, \code{spacing=1} for consecutive spots
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function is used on matrices corresponding to a series of microarray experiments.
Rows corresponding to duplicate spots are re-arranged to that all values corresponding to a single gene are on the same row.
This facilitates fitting models or computing statistics for each gene.
\end{Details}
\begin{Value}
A matrix containing the same values as \code{M} but with fewer rows and more columns by a factor of \code{ndups}.
Each set of \code{ndups} rows in \code{M} is strung out to a single row so that duplicate values originally in consecutive rows in the same column are in consecutive columns in the output.
\end{Value}
\begin{Author}\relax
Gordon Smyth
\end{Author}
\begin{Examples}
\begin{ExampleCode}
M <- matrix(1:12,6,2)
unwrapdups(M,ndups=2)
unwrapdups(M,ndups=3)
unwrapdups(M,ndups=2,spacing=3)
\end{ExampleCode}
\end{Examples}

