Skip to content
Back to formatted view

Raw Message

Message-ID: <x2br289qaz.fsf@turmalin.kubism.ku.dk>
Date: 2005-10-02T10:16:52Z
From: Peter Dalgaard
Subject: convering upper triangular matrix into vector
In-Reply-To: <1128243868.433fa29c83ad0@webmail.cryst.bbk.ac.uk>

e.rapsomaniki at 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 at biostat.ku.dk)                  FAX: (+45) 35327907