.BG
.VE $Header: /usr3/s/current/s/.help/RCS/matrix,v 1.2 83/12/30 19:30:30 rab Exp $
.FN matrix
.TL
matrix: Create Matrix
.CS
matrix(data, nrow, ncol, byrow)
.PP
.AG data
vector containing the data values for the matrix in normal
array order: the first subscript varies most rapidly.
Missing values (NAs) are allowed.
.AG nrow
first subscript, number of rows.
.AG ncol
second subscript, number of columns
.AG byrow
flag, if TRUE the data values are assumed to be the first
row, then the second row, etc. If FALSE (the default) the
values are assumed to be the first column, then the second
column, etc. (this is how the data is stored internally).
Should be TRUE if the data values were read from a file,
arranged by rows.
.PP
If one of `nrow' or `ncol' is omitted, the dimensions of the matrix
are determined by the other argument and the length of `data'.
.RT
an `nrow' by `ncol' matrix with the same mode as `data'.
The matrix is filled column-wise with the data vector given.
If the vector does not fill the matrix, it is repeated until
the matrix is filled (giving a warning if it does not take
an integral number of repetitions of `data').
.EX
m <- matrix(0,4,5) #a 4 by 5 matrix of zeros

mm <- matrix( read("mfile"), ncol=5, byrow=TRUE)
                    #read all rows from the file
.KW array*
.KW matrix
.KW structure
.WR
