## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Time for action – matrix computations

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.

1. Generate a 2 x 2 matrix with default values using `matrix(nrow=2, ncol=2)`.
2. Create a matrix from the `1:4` vector by running `matrix(1:4,nrow=2,ncol=2, byrow="TRUE")`.
3. 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.
4. 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)`.
5. Create two matrices ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required