We will see the basic matrix computations in the forthcoming steps. The matrix computations such as the cross-product of matrices, transpose, and inverse will be illustrated.

- Generate a 2 x 2 matrix with default values using
`matrix(nrow=2, ncol=2)`

. - Create a matrix from the
`1:4`

vector by running`matrix(1:4,nrow=2,ncol=2, byrow="TRUE")`

. - Assign row and column names for the preceding matrix by using the option
`dimnames`

, that is, by running`A <- matrix(data=1:4, nrow=2, ncol=2, byrow=TRUE, dimnames = list(c("R_1", "R_2"),c("C_1", "C_2")))`

at the R console. - Find the properties of the preceding matrices by using the commands
`nrow`

,`ncol`

,`dimnames`

, and few more, with`dim(A); nrow(A); ncol(A); dimnames(A)`

. - Create two matrices ...

Start Free Trial

No credit card required