valentinitnelav / bootstrapnet

R package for bootstrapping indices of bipartite ecological networks
https://valentinitnelav.github.io/bootstrapnet/
MIT License
5 stars 2 forks source link

Error: 'attempt to select less than one element in get1index' when data has only unique interactions #15

Closed valentinitnelav closed 4 years ago

valentinitnelav commented 4 years ago

Need to check why this error happens. Bootstrapping should not fail even if unique interactions, or? If the case, then set an informative error message.

library(dplyr)
library(bipartite)
data(Safariland)

unique_interactions_data <- web_matrix_to_df(Safariland) %>% unique()

boot_networklevel(lst = list(s1 = doubtful_data),
                  col_lower = "lower",   # column name for plants
                  col_higher = "higher", # column name for insects
                  index = "nestedness",
                  level = "both",
                  start = 10,
                  step = 10,
                  n_boot = 6,
                  n_cpu = 2)

## Error in FUN(X[[i]], ...) : 
##  attempt to select less than one element in get1index
valentinitnelav commented 4 years ago

This was not related to unique interaction cases, but rather I had some bug when I tested the function with devtools::load_all().