Skip to content

Commit 29ef2c5

Browse files
committed
Elaborate on getfecmax example and add test #58
1 parent 4c00247 commit 29ef2c5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

R/02_getfecmax.R

+3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
#' @return a numeric value for maximum theoretical fecundity.
1313
#'
1414
#' @examples
15+
#' # This is fmax, the maximum theoretical fecundity
1516
#' x <- getfecmax(lambdaMax = 1.04, S0 = 0.944, S1plus = 0.99, AgeMat = 17)
17+
#' # This is fec0, the fecundity when there is no bycatch mortality (only M)
1618
#' unpr <- npr(S0 = 0.944, S1plus = 0.99, AgeMat = 17, nages = 10000, E = 0)
19+
#' print(x)
1720
#' print(1 / unpr$npr)
1821
#' @export
1922
getfecmax <- function(S0, lambdaMax, S1plus, AgeMat) {

R/test-getfecmax.R

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Test the get max theoretical fecundity fn
2+
test_that("Confirm that unfished nums per recruit are lower than nums per recruit where E>0 (density dependence)", {
3+
f0 <- 1 / npr(S0 = 0.944, S1plus = 0.99, AgeMat = 17, nages = 10000, E = 0)$npr
4+
fmax <- getfecmax(lambdaMax = 1.04, S0 = 0.944, S1plus = 0.99, AgeMat = 17)
5+
expect_true(fmax > f0)
6+
})

0 commit comments

Comments
 (0)