From 15872f671dbada0856ab20dfb0325ce77a48b835 Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Thu, 3 Nov 2022 17:46:08 +0000 Subject: [PATCH] `getReproductionLevel()` makes sense as long as `R_max` is known. Closes #252 --- R/setBevertonHolt.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/setBevertonHolt.R b/R/setBevertonHolt.R index 9802aa05f..845188173 100644 --- a/R/setBevertonHolt.R +++ b/R/setBevertonHolt.R @@ -302,9 +302,8 @@ getRequiredRDD <- function(params) { #' getReproductionLevel(params)) getReproductionLevel <- function(params) { assert_that(is(params, "MizerParams")) - if (params@rates_funcs$RDD != "BevertonHoltRDD") { - stop("This function should only be used if the reproduction function ", - "is Beverton-Holt.") + if (!"R_max" %in% names(params@species_params)) { + stop("No `R_max` is included in the species parameters.") } getRDD(params) / params@species_params$R_max }