[R] extract half a matrix

Tord Snall tord.snall at ebc.uu.se
Thu May 22 16:55:41 CEST 2003


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


Thanks in advance!


Sincerely,
Tord

-----------------------------------------------------------------------
Tord Snäll
Avd. f växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet
Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University
Villavägen 14			
SE-752 36 Uppsala, Sweden
Tel: 018-471 28 82 (int +46 18 471 28 82) (work)
Tel: 018-25 71 33 (int +46 18 25 71 33) (home)
Fax: 018-55 34 19 (int +46 18 55 34 19) (work)
E-mail: Tord.Snall at ebc.uu.se
Check this: http://www.vaxtbio.uu.se/resfold/snall.htm!




More information about the R-help mailing list