[R-sig-eco] using two distance metrices in formula

Sarah Goslee sarah.goslee at gmail.com
Tue Oct 13 16:51:23 CEST 2009


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



More information about the R-sig-ecology mailing list