Error when performing an NMDS in R using package vegdist

17.3k views Asked by At

I'm trying to perform an NMDS in R using the vegan package on a data set that has plots as columns and species counts as columns. My data is in the format of a text file (tab delimited) and contains a lot of '0' species counts. However, when I try to create a distance matrix I get the following error message:

bray <- vegdist(data1, method = "bray")                              

Warning messages: 1: In vegdist(data1, method = "bray") : you have empty rows: their dissimilarities may be meaningless in method “bray” 2: In vegdist(data1, method = "bray") : missing values in results

This prevents me from performing an NMDS:

nmds <- metaMDS(data1, k = 2, 
+           distance = 'bray', autotransform = FALSE)

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

How can I fix this?

Thank you for your answers!

2

There are 2 answers

0
user1182741 On

Some columns contained only 0 counts. Removing these makes it work

0
Vimukthi Gunasekara On

There is no way to make bray-curtis dissimilarity matrix withe zero communities. If you cannot remove the zero values use euclidean distance instead the bray