I'm not at all sure what you mean with your matrix: is that supposed to
be three columns? What about:
> fakedata <- data.frame(X=runif(3), Y = runif(3))
> rownames(fakedata) <- c("A", "B", "C")
> dist(fakedata)
A B
B 0.8617733
C 0.3813032 0.5124284> data.frame(t(combn(rownames(fakedata), 2)), dist=as.vector(dist(fakedata)))
X1 X2 dist
1 A B 0.8617733
2 A C 0.3813032
3 B C 0.5124284
Sarah
On Thu, Dec 22, 2011 at 7:03 PM, Taral <taralx at gmail.com>
wrote:> I'd like to convert a dist into a table/matrix/thingy of the form:
>
> A B value
> A C value
> B C value
>
> (assuming the dist was over 3 names).
>
> Is there a way to do this without using a for loop?
>
> --
> Taral <taralx at gmail.com>
> "Please let me know if there's any further trouble I can give
you."
> ? ? -- Unknown
>
--
Sarah Goslee
http://www.functionaldiversity.org