> x <- matrix (nrow=4, ncol=2, data=c(1,2,3,4,5,6,7,8) )
> x
[,1] [,2]
[1,] 1 5
[2,] 2 6
[3,] 3 7
[4,] 4 8
Properties of a Matrix
We can get specific properties of a matrix:
> dim (x) # tells the
[1] 4 2 dimension of matrix
> nrow (x) # tells
[1] 4 the number of rows
> ncol (x) # tells
[1] 2 the number of columns
Matrix Operations