[R] built a lower triangular matrix from dataframe

nymphita sandrablazquezcabrera at gmail.com
Wed Feb 15 17:47:40 CET 2012


Hi Tsjerk!

Thanks for your quick reply!
It's a nice way to built a lower triangular matrix with zeros in the
diagonal, but what I can't work out is *how to include the values of the
third column of the dataframe inside the matrix*.

I just realized that I forgot to explain something about the dataframe  (the
meaning of i, j ,k) in my post:
The data frame has three columns, the first one (i) corresponds to the "row
subscript" of the matrix [i, ], the second one (j) corresponds to the
"column subscript" of the matrix [ ,j], and the third column in the
dataframe (k) is the value that has to be in the matrix (in position [i,
j]). 

http://r.789695.n4.nabble.com/file/n4391099/df.png 

The result is that the dataframe gives you a position and a value in a lower
triangular matrix: 

http://r.789695.n4.nabble.com/file/n4391099/matrix.png 

Still can't find a solution to built a lower triangular matrix with the
specific values of that dataframe... 
Any more ideas, please?



--
View this message in context: http://r.789695.n4.nabble.com/built-a-lower-triangular-matrix-from-dataframe-tp4390813p4391099.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list