Error when performing an NMDS in R using package vegdist

user1182741 picture user1182741 · May 19, 2013 · Viewed 10.1k times · Source

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!

Answer

user1182741 picture user1182741 · May 20, 2013

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