Matrix
Matrix
Matrices
A matrix is a two-dimensional array where each element has the same mode
(numeric, character, or logical). Matrices are created with the matrix function
Matrix Creation
The is.matrix() function takes an object as input and returns TRUE if the
object is a matrix.
%*% Operator
We can perform the element-wise multiplication of two matrices using the *
operator. But we can do matrix multiplication, with the %*% operator.
solve() Function
The solve() function takes a matrix as input and returns the matrix’s inverse as
output.
t() Function
The dim() function shows the dimension of a matrix. It can also change the dimension of a
matrix and also convert a vector into a matrix by giving it dimensions.
The dimnames() function shows the names of the rows and columns of a matrix. It can also
set or change the names of the rows and columns of a matrix
cbind() and rbind() Functions
Now we filter out the matrix m , based on a condition that the column 2 should be > 6.
Note :
The other columns and rows (which are not used in condition)
corresponding to condition column will be return