Fill lower matrix with vector by row, not column

后端 未结 2 489
孤城傲影
孤城傲影 2021-01-19 01:21

I am trying to read in a variance-covariance matrix written out by LISREL in the following format in a plain text, whitespace separated file:

 0.23675E+01  0         


        
2条回答
  •  再見小時候
    2021-01-19 02:18

    Just read it into the upper triangular portion, rather than the lower:

    S <- diag(6)
    S[upper.tri(S, diag=TRUE)] <- d
    t(S)
    

提交回复
热议问题