christianparobek / skeleSim

Null models, performance testing, and power estimation with population simulations
3 stars 6 forks source link

fsc.histEVCheck throwing an error #37

Closed stranda closed 8 years ago

stranda commented 8 years ago

Certain (what I think are legal) hist.ev matrices cause this function to throw an error. Here is a self-contained R script that demonstrates the issue.

library(skeleSim)

hist.ev <- matrix(c(566,2,5991,927,1,2,3,4,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0),ncol=7) hist.ev

fsc.histEvCheck(hist.ev,rep(100,5),0,0) #should eval to TRUE

now change the sink for source deme 4 from 0 to 3

hist.ev[4,3] <- 3 hist.ev

now an error gets thrown

fsc.histEvCheck(hist.ev,rep(100,5),0,0)

EricArcher commented 8 years ago

Error was in fsc.histEvConverges because growth.rate wasn't a vector. I've changed the function to accept a single value or a vector and create a vector as long as pop.size. Works properly now.