https://github.com/cran/Matrix
Revision b983e87f9f9e9934183cc67b43522c6adc443bb0 authored by Douglas Bates on 15 May 2001, 00:00:00 UTC, committed by Gabor Csardi on 15 May 2001, 00:00:00 UTC
1 parent c82b7f0
Raw File
Tip revision: b983e87f9f9e9934183cc67b43522c6adc443bb0 authored by Douglas Bates on 15 May 2001, 00:00:00 UTC
version 0.3-15
Tip revision: b983e87
Matrix.Rd
\name{Matrix}
\title{Construct a Classed Matrix}
\usage{
Matrix(data=NA, nrow, ncol, byrow=F, dimnames=NULL, tol)
}
\alias{Matrix}
\alias{print.Matrix}
\alias{as.matrix.Matrix}
\description{
    Construct a Matrix of class \code{Matrix}.
}
\arguments{
  \item{data}{an optional numeric data vector or matrix.}
  \item{nrow}{the desired number of rows}
  \item{ncol}{the desired number of columns}
  \item{byrow}{logical. If \code{FALSE}
    (the default) the matrix is filled by columns, otherwise the matrix is
    filled by rows.}
  \item{dimnames}{A \code{\link{dimnames}} attribute for the matrix: a
    \code{list} of length 2.}
}
\value{
    Returns an \code{nrow} by \code{ncol} matrix of class \code{"Matrix"}. 
}
\details{
    If either of \code{nrow} or \code{ncol} is
    not given, an attempt is made to infer it from the length of
    \code{data} and the other parameter.

    Although it is sometime possible to mix unclassed matrices (created
    with \code{matrix}) with ones of class \code{"Matrix"}, it is much
    safer to always use carefully constructed ones of class
    \code{"Matrix"}.
}
\seealso{
    \code{\link{as.Matrix}}, \code{\link{Matrix.class}}, \code{\link{matrix}}.
}
\examples{
Matrix(0, 3, 2)             # a 3 by 2 matrix of zeros

Matrix(1:6, 3, 2)           # a 3 by 2 matrix
Matrix(1:6, nrow=3)   
Matrix(1:6, ncol=2)   
Matrix(1:9, nrow=3, dimnames =list(c("a", "b", "c"), c("A", "B", "C")))
}
\keyword{array}
\keyword{algebra}
back to top