Matrix (R)

A matrix is a two-dimensional, rectangular array in R where every element is the same type. It is a vector with a dim (dimension) attribute giving it rows…