https://github.com/cran/pracma
Raw File
Tip revision: 392ae21a013fb3f518e8f9eb8efb458a55a2eca2 authored by HwB on 09 April 2011, 00:00:00 UTC
version 0.3-0
Tip revision: 392ae21
reshape.Rd
\name{reshape}
\alias{reshape}
\title{Reshape Matrix}
\description{
  Reshape matrix or vector.
}
\usage{
reshape(a, n, m)
}
\arguments{
  \item{a}{matrix or vector}
  \item{n, m}{size of the result}
}
\details{
  \code{reshape(a, n, m)} returns the n-by-m matrix whose elements are taken
  column-wise from \code{a}.

  An error results if \code{a} does not have \code{n*m} elements.
  If \code{m} is missing, it will be calculated from \code{n} and the
  size of \code{a}.
}   
\value{
  Returns matrix (or array) of the requested size containing the elements
  of \code{a}.
}
\examples{
a <- matrix(1:12, nrow=4, ncol=3)
reshape(a, 6, 2)
reshape(a, 6)     # the same
reshape(a, 3, 4)
}
\keyword{array}

back to top