Matrix: 2D array of data elements
They contain elements of the same atomic types. Though we can create a matrix containing only characters or only logical values, they are not of much use.
We use matrices containing numeric elements to be used in mathematical calculations.
A Matrix is created using the matrix() function.
The basic syntax for creating a matrix in R
matrix(data, nrow, ncol, byrow, dimnames)
Observe below examples
Read elements of matrix
Matrix arithmetic Calculations
We construct the transpose of a matrix by interchanging its columns and rows with the function t
No comments:
Post a Comment