[R] Using the mantel test in Ape Package

Sarah Goslee sarah.goslee at gmail.com
Thu Mar 15 00:32:47 CET 2012


Hi,

On Wed, Mar 14, 2012 at 2:21 PM, Dorothea Hill
<dorothea.hill at zoo.ox.ac.uk> wrote:
> Hi,
>
> I am trying to use a mantel test on two distance matrices. The code I have entered for each is:
>
> Gen_dists <- read.csv(file.choose(),
>                                                stringsAsFactors = FALSE,
>                                                na.strings = c(" "),
>                                                fill = T,
>                                                header = FALSE,
>                  blank.lines.skip = FALSE)
>
> Gen_matrix <- as.matrix(Gen_dists)
>
> mantel.test(Geo_matrix, Gen_matrix, nperm = 999, graph = T, alternative = "great")
>
> I am getting a result but with lots of warning messages :
> "Warning: non-square matrix"
>
> However, my matrices are square!

Not according to R. Somewhere in the import or modification steps they
have become unsquare. Since you provide neither a reproducible example
nor any description of your matrices -- str() and dim() seem
particularly relevant -- we can't possibly tell you where.

Sarah


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



More information about the R-help mailing list