AnneChao / SpadeR

SpadeR provides simple R functions to compute various biodiversity indices and related (dis)similarity measures based on individual-based (abundance) data or sampling-unit-based (incidence) data taken from one or multiple communities/assemblages.
27 stars 10 forks source link

Error 'invalid 'type' (list) of argument' in SimilarityPair #15

Open fboetzl opened 1 year ago

fboetzl commented 1 year ago

When using SimilarityPair, I am receiving an error for some of my comparissons but not for all of them. I provide a reproducible example here:

library(SpadeR)

sample <- read.csv('sample.csv', header=T, sep=",", na.strings="NA", fileEncoding = "ISO-8859-1")
sample <- sample[,-1]

SimilarityPair(sample, "incidence_freq", nboot = 200)

Error in sum(sapply(I, function(I) 2 * min(boot.X1[I], boot.X2[I]))) :  invalid 'type' (list) of argument

sample.csv (sample data is attached)

The sample assemblages here have more than 3 species but not much overlap (2 species) - is this the problem? I assume it should not be a problem?

I would be very glad for your help!

With best regards,

Fabian

EDIT: After some trial and error, I found out that the problem depends on the value set for 'nboot'. The chance of SimilarityPair computing to an outcome seems to be much higher at lower nboot values than at higher ones. This results at common failures at nboot = 200 for at least one of the pairs (while the fails are rare at nboot = 10).