I have a list of a total of 55 numeric values. I want to create a 10x10 matrix in which only the lower (or upper) triangular matrix (with the diagonal itself) is populated. I know that I can use lower.tri()
to create a lower triangular matrix, however, when I use this function, it seems like data is not populated by row. If i use, matrix(v, nrow= 10, ncol= 10, byrow= TRUE)
then the full matrix is populated instead of just the lower diagonal. I have seen solutions to a similar problem (Fill lower matrix with vector by row, not column), but in that example, they use only 6 variables, whereas I have 10, and that solution gets distorted for me.
v <- 1:55
m <- diag(10)