-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Error appeared in the Poland dataset when computing closeness and betweenness
dt <- read.csv2("../data/Interactions_PL18_ver2.csv")
setDT(dt) # convert to data.table; to convert back just run setDF(dt_raw)
# Prepare a table with all observed interactions, replicated by the number of
# visits observed.
set.seed(123)
dt_interactions <-
dt[, .(abund = sum(Individuals, na.rm = TRUE)),
by = c("Meadow.type", "Plant", "Insect.species")] %>%
.[rep(1:.N, times = abund)] %>% # expand/explode
.[sample(1:nrow(.))] # shuffle
dt_meadow <- dt_interactions[Meadow.type == "Meadow"]
dt_pasture <- dt_interactions[Meadow.type == "Pasture"]
# Get an idea about the total number of interactions
dt_meadow$abund %>% unique %>% sum
dt_pasture$abund %>% unique %>% sum
start_spl <- 30
step_spl <- 20
system.time({
lst_closeness <-
boot_specieslevel(lst = list(meadow = dt_meadow,
pasture = dt_pasture),
col_lower = "Plant", # column name for plants
col_higher = "Insect.species", # column name for insects
index = "closeness",
level = "both",
start = start_spl,
step = step_spl,
n_boot = 100,
n_cpu = 3)
})
## Error in FUN(X[[i]], ...) : subscript out of boundsReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request