extract half a matrix
At 16:55 22/05/2003 +0200, vous avez ?crit:
Dear all,
I'm new to matrix operations in R. I couln't find a solution to the
following problem among earlier help mails or in An introd to R, I guess
because the question is really basic.
I want to extract all above the diagonal, i.e. from
1 2 3 4
1 0 26 49 49
2 26 0 44 40
3 49 44 0 21
4 49 40 21 0
I want
26
49
44
49
40
21
If your matrix is named M, this should do it: M[row(M) < col(M)] EP
Thanks in advance! Sincerely, Tord