Error with metaMDS
On Mon, 2013-06-24 at 19:33 +0800, Suparna Mitra wrote:
H ello R-experts, I want to do ordination plots using vegan metaMDS. I have a where many cells have zero values.
<snip />
I am having two different kind of errors for these two data... Error 1
ord1 <- metaMDS(
X ="bray")
That is fundamentally wrong - you are setting argument `X` to the
character vector `"bray"`, that is not how you call metaMDS(). Hence I
suspect you didn't bother to include the full code...!
Let's assume you cal actually call metaMDS() correctly...
The first set of warnings (not the error) come `vegdist()`. The first is
from :
if (method > 2 && any(rowSums(x, na.rm = TRUE) == 0))
and hence if you do
which(rowSums(X, na.rm = TRUE) == 0)
you'll see which rows (samples) have no counts at all. The second
warning in the first set comes from
if (any(is.na(d)))
warning("missing values in results")
hence by the time vegdist has computed the dissimilarity, those
computation ended up generating one or more `NA` values. Things go
downhill from there as the error generated from within metaMDS() is
because we are comparing the distances with the smallest representable
number and any comparison with `NA` yields `NA` and hence the first
Error you see. We should probably catch that but I don't have a
reproducible example to see why we don't...
Square root transformation
Wisconsin double standardization
Error in if (any(dist < -sqrt(.Machine$double.eps))) warning("some
dissimilarities are negative -- is this intentional?") :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In distfun(comm, method = distance, ...) :
you have empty rows: their dissimilarities may be meaningless in method
bray
2: In distfun(comm, method = distance, ...) : missing values in results
Error 2
ord.data= metaMDS(data, distance="bray")
Error in if (any(autotransform, noshare > 0, wascores) && any(comm < 0)) {
:
missing value where TRUE/FALSE needed
In addition: Warning message:
In Ops.factor(left, right) : < not meaningful for factors
Look at `str(data)` and if any of the columns are factors, change them to be numeric or find out why R thinks they are factors - it wouldn't normally convert numeric data to a factor when reading the data in. What is `data`? You only refer to `Genus_data`. Please try to be specific about exactly what you did - i.e. include the actual code. I suspect the things you try below are pointless as it is not zero distances that are the problem but sites for which no observations were recorded. G
I searched all the details of metaMDS where it is suggested to avail the argument 'zerodist' So I tried both X.dist1 <- metaMDSdist(X, method="bray",zerodist = "ignore") X.dist2 <- metaMDSdist(X, method="bray",zerodist = "add") Can Please help me with this. Thanks, Mitra [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Gavin Simpson, PhD [t] +1 306 337 8863 Adjunct Professor, Department of Biology [f] +1 306 337 2410 Institute of Environmental Change & Society [e] gavin.simpson at uregina.ca 523 Research and Innovation Centre [tw] @ucfagls University of Regina Regina, SK S4S 0A2, Canada