From 5fb6f2ab6bc76c809761ad11ae9e6a27403f1dfc Mon Sep 17 00:00:00 2001 From: Gustav Delius Date: Fri, 2 Aug 2024 21:43:56 +0100 Subject: [PATCH] `setExtEncounter()` no longer resets the external encounter rate to zero when called without the `ext_encounter` argument. --- DESCRIPTION | 4 ++-- NEWS.md | 7 +++++-- R/newMultispeciesParams.R | 1 + R/setExtEncounter.R | 4 ++-- man/newMultispeciesParams.Rd | 3 ++- man/setExtEncounter.Rd | 3 ++- man/setParams.Rd | 1 + 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 789e77ad..a3bbbe0a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,7 @@ Authors@R: c(person("Gustav", "Delius", email="gustav.delius@york.ac.uk", comment = c(ORCID = "0000-0002-8478-3430")), person("Richard", "Southwell", email="richard.southwell@york.ac.uk", role=c("ctb", "cph"))) -Version: 2.5.1.9001 +Version: 2.5.1.9002 License: GPL-3 Imports: assertthat, @@ -103,7 +103,7 @@ Collate: 'matchGrowth.R' 'steadySingleSpecies.R' 'defaults_edition.R' -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) Encoding: UTF-8 LazyData: true diff --git a/NEWS.md b/NEWS.md index 616459be..1c4f0c88 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,9 @@ -## Updating default values for plotBiomassObservedVsModel +# Development version -The function `plotBiomassObservedVsModel` now plots the ratio of modelled +- `setExtEncounter()` no longer resets the external encounter rate to zero when + called without the `ext_encounter` argument. + +- The function `plotBiomassObservedVsModel()` now plots the ratio of modelled to observed biomass as default (`ratio = T`), as this is more useful visually to see how far off modelled biomass is from observed biomass. diff --git a/R/newMultispeciesParams.R b/R/newMultispeciesParams.R index 9fed3a6e..cdb0d0e6 100644 --- a/R/newMultispeciesParams.R +++ b/R/newMultispeciesParams.R @@ -236,6 +236,7 @@ newMultispeciesParams <- function( #' \item [setMaxIntakeRate()] #' \item [setMetabolicRate()] #' \item [setExtMort()] +#' \item [setExtEncounter()] #' \item [setReproduction()] #' \item [setFishing()] #' \item [setResource()] diff --git a/R/setExtEncounter.R b/R/setExtEncounter.R index f872c7f1..e3e49f9f 100644 --- a/R/setExtEncounter.R +++ b/R/setExtEncounter.R @@ -10,7 +10,8 @@ #' #' @param params MizerParams #' @param ext_encounter Optional. An array (species x size) holding the external -#' encounter rate. If not supplied, a default of 0 is used. +#' encounter rate. If not supplied, the external encounter rate is left +#' unchanged. Initially is is set to 0. #' @param ... Unused #' #' @return `setExtEncounter()`: A MizerParams object with updated external encounter @@ -36,7 +37,6 @@ setExtEncounter <- function(params, ext_encounter = NULL, ...) { if (is.null(ext_encounter)) { ext_encounter <- params@ext_encounter - ext_encounter[] <- 0 } assert_that(is.array(ext_encounter), diff --git a/man/newMultispeciesParams.Rd b/man/newMultispeciesParams.Rd index 0992c95f..070e7455 100644 --- a/man/newMultispeciesParams.Rd +++ b/man/newMultispeciesParams.Rd @@ -92,7 +92,8 @@ the species data frame, it is calculated as \code{z0pre * w_max ^ z0exp}. Default value is \code{n-1}.} \item{ext_encounter}{Optional. An array (species x size) holding the external -encounter rate. If not supplied, a default of 0 is used.} +encounter rate. If not supplied, the external encounter rate is left +unchanged. Initially is is set to 0.} \item{maturity}{Optional. An array (species x size) that holds the proportion of individuals of each species at size that are mature. If not supplied, a diff --git a/man/setExtEncounter.Rd b/man/setExtEncounter.Rd index 3aee9376..38c36610 100644 --- a/man/setExtEncounter.Rd +++ b/man/setExtEncounter.Rd @@ -19,7 +19,8 @@ ext_encounter(params) <- value \item{params}{MizerParams} \item{ext_encounter}{Optional. An array (species x size) holding the external -encounter rate. If not supplied, a default of 0 is used.} +encounter rate. If not supplied, the external encounter rate is left +unchanged. Initially is is set to 0.} \item{...}{Unused} diff --git a/man/setParams.Rd b/man/setParams.Rd index c184d6a7..a7322b9f 100644 --- a/man/setParams.Rd +++ b/man/setParams.Rd @@ -75,6 +75,7 @@ functions \item \code{\link[=setMaxIntakeRate]{setMaxIntakeRate()}} \item \code{\link[=setMetabolicRate]{setMetabolicRate()}} \item \code{\link[=setExtMort]{setExtMort()}} +\item \code{\link[=setExtEncounter]{setExtEncounter()}} \item \code{\link[=setReproduction]{setReproduction()}} \item \code{\link[=setFishing]{setFishing()}} \item \code{\link[=setResource]{setResource()}}