Data Science
Working with Matrix in R programming
If we want to store data of same mode or type in a two-dimensional array in R data analysis, matrix may be the most appropriate data structure to use. A matrix is just coming from a vector expanded in two dimensions with rows and columns, this is why the input subject is often a vector when a matrix is generated.