0

I'm quite new to R and I'm trying to perform a permanova using the adonis2 function. I don't understand all in the documentation as they speak about the dependent variable being a community data matrix or a dissimilarity matrix, but I tried to apply adonis2 on this:

Group = rep(c(0,1), each = 10)
data <- data.frame(
  f1 = rnorm(20),
  f2 = rnorm(20)
)

# Perform PERMANOVA
adonis2(Group ~ f1+f2, data = data)

and I get the following error:

Error in if (any(lhs < -TOL)) stop("dissimilarities must be non-negative") : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In vegdist(as.matrix(lhs), method = method, ...) :
  you have empty rows: their dissimilarities may be
                 meaningless in method “bray”
2: In vegdist(as.matrix(lhs), method = method, ...) :
  missing values in results

which is apparently due to the label 0 in group (no error when I change it to another strictly positive number). Can someone please help me understand why the 0 causes a problem?

Thanks.

User34t
  • 1
  • 1

0 Answers0