Re: [R] convering upper triangular matrix into vector

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Sun 02 Oct 2005 - 20:16:52 EST

e.rapsomaniki@mail.cryst.bbk.ac.uk writes:

> Hi
>
> I have two symmetrical distance matrices and want to compute the correlation
> coefficient between them (after turning them into vectors).
>
> Is there a way of selecting only the upper triangular part of each matrix, then
> convert this into a vector so I can compute the correlation?

X[upper.tri(X)]

(as help.search("triangular") would have told you soon enough)

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sun Oct 02 20:20:21 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:08:20 EST