BEE-Univ-Grenoble / BeePODYNA

0 stars 1 forks source link

Problem on summary_population with to small iterations of size vector. #8

Open gowachin opened 4 years ago

gowachin commented 4 years ago

Issue in summary_population. It depend on the size of the size vector, in the 4th part of the summary (line 172-214 of summary_population.R I think).

Example working with length longer than 4.

cats <- list(label = "cats", size = c(1,1.2,1.3,1.4,1.5), time = c(1:5),
             growth_rate = 1.5, capacity = 24)
cats <- as_population(cats)
summary(cats)

Example not working with lenght of 4.

cats <- list(label = "cats", size = c(1,1.2,1.3,1.4), time = c(1:4),
             growth_rate = 1.5, capacity = 24)
cats <- as_population(cats)
summary(cats)

return error and print a partial summary.

Error in data.frame(Generations = names.ch, `Rates of change` = c("-",  : 
  les arguments impliquent des nombres de lignes différents : 4, 5
gowachin commented 4 years ago

Another troubleshooting appear if populations in a community don't have the same length. It's the same part (4th) of the summary but in summary.community() function.

To reproduce it :

butterfly <- population(label = "butterfly", initial_size = 13, growth_rate = 1, capacity = 50)
cats <- list(label = "cats", size = c(1,1.2,1.3,1.4,1.5), time = c(0:4),  growth_rate = 1.5, capacity = 24)
cats <- as_population(cats)
wasteland <- community(label = 'wasteland',cats , butterfly )
summary(wasteland)

return error :

Error in ratesv[n] <- v[length(v) - 1]/v[length(v)] : 
  l'argument de remplacement est de longueur nulle 

lapply(X = sizes, FUN = rates_c3, n = gens1) at summary_population.R#522