What's new

YouTube R Programming Introduction: Matrices (R intro-05)

Nicole Seaman

Chief Admin Officer
Staff member
In R a matrix is an atomic vector with the dimension attribute. In this example, the correlation matrix is entered as a vector with sixteen elements: rho_v <-c(1.000, ...). Then the vector is translated into a matrix with rho <- matrix(rho_v, nrow = 4, ncol =4). Now it is a matrix because it has an attribute: $dim = c(4,4). This array happens to be 2-dimensional (aka, matrix) because we could have n-dimensions.

David's script is here https://github.com/bionicturtle/youtube/tree/master/r-intro

YT sub small.png
Last edited: