[R] Mantel test

David L Carlson dcarlson at tamu.edu
Wed May 6 16:48:39 CEST 2015

Please keep the discussion on the list. It is hard to answer your question without context. You give us a warning message from a function that is not in base R. Perhaps it is in package ade? You also don’t include anything about the data or the commands that produced the warning message. A dist object does not contain a diagonal so your comment suggests that you did not convert the matrix to a dist object.

David C

From: Nick Jeffery [mailto:nick.w.jeffery3 at gmail.com]
Sent: Wednesday, May 6, 2015 9:34 AM
To: David L Carlson
Subject: Re: [R] Mantel test

Thanks for the help. I get these warnings when I run the Mantel test however - is this because the diagonal of the matrix is all 0s? Both are symmetrical matrices about the diagonal line of zeroes.

Warning messages:

1: In is.euclid(m1) : Zero distance(s)

2: In is.euclid(m2) : Zero distance(s)

Thanks for your time,


On Mon, May 4, 2015 at 3:48 PM, David L Carlson <dcarlson at tamu.edu<mailto:dcarlson at tamu.edu>> wrote:
Assuming the 'matrix' format is a symmetrical distance 'matrix' stored as a data frame (which read.csv creates) rather a rectangular data 'matrix,' you can convert it to a dist object with as.dist().


David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org<mailto:r-help-bounces at r-project.org>] On Behalf Of Nick Jeffery
Sent: Monday, May 4, 2015 10:49 AM
To: r-help at r-project.org<mailto:r-help at r-project.org>
Subject: [R] Mantel test

Dear R users,

I'm having trouble getting my data into R in the correct format to run a
Mantel test.

I'm testing genome size differences by genetic distances of the 28S gene
for ~30 species. I'm able to get my genome size data (as a single column of
data) into matrix and dist formats in R but the genetic distances output by
MEGA are already in 'matrix' format so I don't know how to load this CSV
file into R without it calculating new genetic distances when I convert it
to the dist form required by the test.

Thanks in advance,

Nick Jeffery, PhD Candidate
Integrative Biology
SCIE 1453
University of Guelph
Guelph, Ontario, Canada
        [[alternative HTML version deleted]]

R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Nick Jeffery, PhD Candidate
Integrative Biology
SCIE 1453
University of Guelph
Guelph, Ontario, Canada

	[[alternative HTML version deleted]]

More information about the R-help mailing list