Skip to content
Back to formatted view

Raw Message

Message-ID: <efb536d50910130751w52ea9c8dpbc43cd1643f613f4@mail.gmail.com>
Date: 2009-10-13T14:51:23Z
From: Sarah Goslee
Subject: using two distance metrices in formula
In-Reply-To: <4AD48CC7.4050704@gmx.de>

Jens,

You can make your imported dissimilarities into a dist object quite easily.

Say D is your imported dissimilarity data. It needs to be in lower-triangular
format (assuming you imported it as a symmetric square matrix).

D <- as.matrix(D)
D <- D[col(D) < row(D)]
attr(D, "Size") <- N # number of samples (# of rows and cols)
attr(D, "Labels") <- 1:N # or names of samples, of length N
attr(D, "Diag") <- FALSE
attr(D, "Upper") <- FALSE
attr(D, "method") <- "imported" # name of index, or NULL
class(D) <- "dist"

Sarah

On Tue, Oct 13, 2009 at 10:20 AM, Jens Oldeland <oldeland at gmx.de> wrote:
> Dear R-sig-ecology group,
>
> is there a way to use two self-made dissimilarity matrices for the left-hand
> side (LHS) and right hand side (RHS) in vegan functions such as capscale or
> adonis?
> I created those matrices in a GIS using 3D-information therefore I don?t
> want to simply use distances between 2D-coordinates. But as I found out,
> there is only the possibility to use a dist object for LHS.
>
> Can anyone suggest a solution or had similar problems?
>
> best regards,
> Jens
>
> --


-- 
Sarah Goslee
http://www.functionaldiversity.org