metaMDS telling me I have negative values when I have zeroes

57 Views Asked by At

I keep getting this error when trying to perform metaMDS on my ecology data, same as this post.

'comm' has negative data: 'autotransform', 'noshare' and 'wascores' set to FALSE
Error in distfun(comm, method = distance, ...) : 
  input data must be numeric

I have thoroughly checked and do not think I have negative values. I believe it thinks my zeroes are negative values?.

Here is my code with the error after the metaMDS step:

df = read.csv("nmds.csv", header = TRUE)
com = df[,4:ncol(df)]
m_com = as.matrix(com)

set.seed(12345)
nmds = metaMDS(m_com, distance = "bray")
nmds

'comm' has negative data: 'autotransform', 'noshare' and 'wascores' set to FALSE
Error in distfun(comm, method = distance, ...) : 
  input data must be numeric

I've tried removing 0 values using m_com[rowSums(m_com[])>0,] but it gives me this error as well:

Error in rowSums(m_com[]) : 'x' must be numeric

I have gotten this code to work on previous datasets with many zeroes as well I don't know what the issue is this time! See below for what m_com looks like. Thank you all.

What m_com looks like

0

There are 0 best solutions below