Skip to content

Commit

Permalink
add test for < 0
Browse files Browse the repository at this point in the history
  • Loading branch information
atyre2 committed Mar 4, 2019
1 parent d782538 commit a1fad74
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/iterator.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ iterate_pop <- function(N0 = NULL, parms = NULL, popfun = NULL){
# pass N[,] as a matrix to accomodate
for (i in seq_along(parms$t[-last_t])){
N[i+1,] <- do.call(popfun, c(N0=list(N[i,]), as.list(parms[i,])))
if (any(N[i+1,]< 0)){
set2zero <- N[i+1,] < 0
N[i+1, set2zero] <- 0
}
}
if(!is.null(names(N0))){
# fix column names here -- if done before do.call() c() concatenates colnames
Expand Down

0 comments on commit a1fad74

Please sign in to comment.