From 7bf91ffca2929635ab73a2f29ce42abccb0a920d Mon Sep 17 00:00:00 2001 From: Hughes Date: Fri, 17 Jan 2025 11:39:30 -0500 Subject: [PATCH] Fix error in simulation of recruitment data. --- R/internal_demog_fns.R | 3 ++- man/popGrowthTableJohnsonECCC.Rd | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/R/internal_demog_fns.R b/R/internal_demog_fns.R index 2b629e9..9529184 100644 --- a/R/internal_demog_fns.R +++ b/R/internal_demog_fns.R @@ -169,12 +169,13 @@ simCalfCowRatios <- function(cowCounts, minYr, exData) { if(sum(ageRatioOut$cow>ageRatioOut$N,na.rm=T)){ warning("The expected number of cows in composition survey exceeds population size. Adjusting cows in survey for consistency.") + ageRatioOut$cow = pmin(ageRatioOut$cow,ageRatioOut$N) } #apparent number of calves (M+F) from apparent number of cows using apparent recruitment rate ageRatioOut$calf <- ifelse(ageRatioOut$cow == 0, 0, rbinom( - n = nrow(ageRatioOut), size = pmin(ageRatioOut$cow,ageRatioOut$N), + n = nrow(ageRatioOut), size = ageRatioOut$cow, prob = ageRatioOut$recruitment ) ) diff --git a/man/popGrowthTableJohnsonECCC.Rd b/man/popGrowthTableJohnsonECCC.Rd index 88ab55d..721b9ba 100644 --- a/man/popGrowthTableJohnsonECCC.Rd +++ b/man/popGrowthTableJohnsonECCC.Rd @@ -5,7 +5,7 @@ \alias{popGrowthTableJohnsonECCC} \title{Population growth model table for Johnson models} \format{ -An object of class \code{data.frame} with 27 rows and 9 columns. +An object of class \code{data.frame} with 32 rows and 9 columns. } \usage{ popGrowthTableJohnsonECCC