# HG changeset patch # User greg # Date 1512139084 18000 # Node ID fdc148a9695af2b2915b45b60f1debed434eca58 # Parent b6b42e12e173db97f16b08a4160396349e7b5753 Uploaded diff -r b6b42e12e173 -r fdc148a9695a insect_phenology_model.R --- a/insect_phenology_model.R Fri Dec 01 09:28:01 2017 -0500 +++ b/insect_phenology_model.R Fri Dec 01 09:38:04 2017 -0500 @@ -213,7 +213,7 @@ # Generation, Stage, degree-days, T, Diapause. vec.ini <- c(0, 3, 0, 0, 0) # Overwintering, previttelogenic, degree-days=0, T=0, no-diapause. - vec.mat <- rep(vec.ini, n) + vec.mat <- rep(vec.ini, num_insects) # Complete matrix for the population. vec.mat <- base::t(matrix(vec.mat, nrow=5)) # Time series of population size. @@ -240,7 +240,7 @@ # Newborn. birth.vec <- NULL # All individuals. - for (i in 1:n) { + for (i in 1:num_insects) { # Find individual record. vec.ind <- vec.mat[i,] # First of all, still alive? @@ -457,7 +457,7 @@ num_insects <- num_insects - num_insects.death + num_insects.newborn # Aggregate results by day. - tot.pop <- c(tot.pop, n) + tot.pop <- c(tot.pop, num_insects) # Egg. s0 <- sum(vec.mat[,2] == 0) # Young nymph.