[R] extract half a matrix

Roger Koenker roger at ysidro.econ.uiuc.edu
Thu May 22 17:24:31 CEST 2003


A[row(A)<col(A)]


url:	www.econ.uiuc.edu	Roger Koenker		Dept. of Economics UCL,
email	rkoenker at uiuc.edu	Department of Economics Drayton House,
vox: 	217-333-4558		University of Illinois	30 Gordon St,
fax:   	217-244-6678		Champaign, IL 61820	London,WC1H 0AX, UK
							vox:	020-7679-5838

On Thu, 22 May 2003, Tord Snall wrote:

> 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!
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list