Hello,

I'm trying to extract interspecific distances from a large distance matrix
using APE. However, my approach returns a vector.

Consider the following illustrative example:

library(ape)
data(woodmouse)

d <- dist.dna(woodmouse, model = "raw") # get p-distance matrix
labs <- labels(woodmouse) # get species names
o <- outer(labs, labs, "==") # this is a matrix
inter <- d[!o] # this is a vector of interspecific distances

What I need is for 'inter' to be a matrix so I can use split() to split the
matrix into lists by species.

Simply coercing to a matrix with as.matrix(inter) destroys the structure of
the distance matrix.

Any assistance is appreciated.

Thanks!

Cheers,

Jarrett

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to