Construct a Classed Matrix

DESCRIPTION:

Construct a Matrix of class . .LB Matrix

USAGE:

Matrix(data=NA, nrow, ncol, byrow=F, dimnames=NULL, tol) 

REQUIRED ARGUMENTS:

data
vector of data values for the matrix.

OPTIONAL ARGUMENTS:

nrow,ncol
The desired number of rows / columns for the matrix. If both dimensions are left unspecified, the default is a column vector if 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
Data values are assigned to the matrix by row if byrow = T and otherwise by column.
dimnames
A list of length 2 giving a dimnames attribute for the matrix. Each element of the list must be either NULL or else a vector of character strings of length equal to the corresponding element of the dim attribute of the result.

VALUE:

Returns an nrow by ncol matrix of class "Matrix" .

DETAILS:

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" .

SEE ALSO:

, , .

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")))