0

Hello dear internet community !

I was trying to use the betadisper() function from vegan{} when I encounter a very new issue for me. The error i get is the following :

Error in pts[groups == i, , drop = FALSE] : 
          (subscript) logical subscript too long

So, I figured I would check the issue by googling it and I've seen a few posts relating the same kind of issue. I've find that I could use the trace() and traceback() functions to see what the problem was and so, before I post the results, here is a description of what i'm trying to achieve.

I am trying to use betadisper() to see the multivariate dispersion of plant species abundance with regard to different environmental variables. The data is made out of 2432 rows for 898 species and 5 environmental variables.

Here is what I do with the data :

X_env <- as.matrix(Y[,c( 16:19)]) # subsetting the environmental variables from the core matrix
X_abondance <- Y[, 22:1010]  # subsetting the abundance data from the core matrix
X_abondance <- decostand(X_abondance, method = "hellinger")
dist_X_abon <- dist(X_abondance, method = "euclidean")
disper_bobb <- betadisper(dist_X_abon, bobb_env)

And this is where I have the error message. let's see what trace() have to say :

4: ordimedian(vectors, group, choices = axes[pos])
3: spatialMed(vectors, group, pos)
2: betadisper(dist_X_abon, X_env)
1: trace(disper_X <- betadisper(dist_X_abon, X_env))

At this point, I'm lost and I don't know what to do... It is the first time I have this issue and I do not exactly know how to resolve it, if anyone has an idea I would very much appreciate your help !

www
  • 38,575
  • 12
  • 48
  • 84
Pinceloup
  • 11
  • 5

1 Answers1

1

I have found why I couldn't proceed with the betadisper function. I was trying to use different categories of variables, which is impossible to do here. When i use only one variable which has different levels, i can make it work perfectly fine.

Pinceloup
  • 11
  • 5