What is the difference between Matrix and an array ?

Question

Matrix and array difference in R

in progress 0
Ritika Sohal 55 years 1 Answer 1065 views Member 0

Answer ( 1 )

  1. ARRAYS
    Arrays can contain greater than or equal to 1 dimensions.
    Array is a homogenous data structure.
    It is a singular vector arranged into the specified dimensions.
    array() function can be used to create matrix by specifying the third dimension to be 1.
    Arrays are superset of matrices.
    Limited set of collection-based operations.
    Mostly, intended for storage of data.

    MATRICES

    Matrices contains 2 dimensions in a table like structure.
    Matrix is also a homogenous data strucrure.
    It comprises of multiple equal length vectors stacked together in a table.
    matrix() function however can be used to create at most 2-dimensional array.
    Matrices are a subset, special case of array where dimensions is two.
    Wide range of collection operations possible.
    Mostly, matrices are intended for data transformation.

Leave an answer

Browse
Browse