Matrix(data=NA, nrow, ncol, byrow=F, dimnames=NULL, tol)
byrow = F
and a
row vector if
byrow = T
.
If only one of
nrow
or
ncol
is missing,
the other is chosen according to the length of the data.
byrow = T
and
otherwise by column.
NULL
or else a vector of character
strings of length equal to the corresponding element of the
dim
attribute of the result.
nrow
by
ncol
matrix of class
"Matrix"
.
The input data must be a vector. If you specify both
nrow
and
ncol
, you can supply a single value for
data
and that value will
be used to fill the matrix.
Although it is sometime possible to mix unclassed matrices (created
with
matrix
) with ones of class
"Matrix"
, it is much safer to
always use carefully constructed ones of class
"Matrix"
.
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")))