From 8b976e0dd7941c33afad1f706db270bc9e50c85f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Nov 2026 15:14:22 +0000 Subject: [PATCH 1/3] Initial plan From 84a96bf1d0d80af523e1283cf463abe8f1009f5e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Nov 2026 15:16:05 +0000 Subject: [PATCH 2/3] Fix malformed Rd documentation Co-authored-by: iagomosqueira <1029847+iagomosqueira@users.noreply.github.com> --- R/FLArray.R | 6 +++--- R/data.R | 2 +- R/genericMethods.R | 2 +- R/oem.R | 11 +++++++---- man/Extract.Rd | 6 +++--- man/datasets.Rd | 2 +- man/metrics.Rd | 2 +- man/rlnormar1.Rd | 11 +++++++---- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/R/FLArray.R b/R/FLArray.R index 560a8ac4..690f9ba1 100644 --- a/R/FLArray.R +++ b/R/FLArray.R @@ -133,9 +133,9 @@ setquant <- function(x, value) { #' @rdname Extract #' @aliases [,FLArray,ANY,ANY,ANY-method #' @docType methods -#' @section Generic function: \describe{ \item{}{[x,i,j,drop]} -#' \item{}{[<-(x,i,j,value)} \item{}{[[<-(x,i,j,value)} -#' \item{}{\$<-(x,name,value)} } +#' @section Generic function: \describe{ \item{\code{[}}{[x,i,j,drop]} +#' \item{\code{[<-}}{[<-(x,i,j,value)} \item{\code{[[<-}}{[[<-(x,i,j,value)} +#' \item{\code{\$<-}}{\$<-(x,name,value)} } #' @param x object from which to extract or replace element(s) #' @param i,j,k,l,m,n indices specifying elements to extract or replace on any of the six dimensions. #' @param ... indices specifying elements to extract or replace by dimension name. diff --git a/R/data.R b/R/data.R index 5424e62c..6c635481 100644 --- a/R/data.R +++ b/R/data.R @@ -10,7 +10,7 @@ #' #' Example datasets for the classes defined in FLCore. #' -#' \itemize{ +#' \describe{ #' \item{\code{ple4}, \code{\link{FLStock}}}{A dataset for North Sea (ICES Area IV) #' plaice. Catch, landings, discards, natural mortality, weight-at-age and maturity, #' together with the VPA estimated abundances and fishing mortalities.} diff --git a/R/genericMethods.R b/R/genericMethods.R index 21e24cc3..233df5d3 100644 --- a/R/genericMethods.R +++ b/R/genericMethods.R @@ -1669,7 +1669,7 @@ setGeneric("fwd", function(object, fishery, control, ...) #' @aliases metrics metrics-methods #' #' @author The FLR Team -#' @seealso \link{FLComp}, link{FLStock}, \link{FLBiol} +#' @seealso \link{FLComp}, \link{FLStock}, \link{FLBiol} #' @keywords methods #' @md setGeneric("metrics", function(object, metrics, ...) diff --git a/R/oem.R b/R/oem.R index 3ce3705f..d5cd7031 100644 --- a/R/oem.R +++ b/R/oem.R @@ -733,11 +733,14 @@ ar1rlnorm <- function(rho, years, iters=1, meanlog=0, sdlog=1, #' the simulated log-normal AR(1) series. #' #' @details The simulation proceeds as follows: -#' 1. Draw independent normal innovations: eps_{t,i} ~ N(meanlog_i, sdlog_i^2). -#' 2. Build the AR(1) process: x_{t,i} = rho_i * x_{t-1,i} + sqrt(1 - rho_i^2) * eps_{t,i}, -#' with x_{1,i} = eps_{1,i}. +#' 1. Draw independent normal innovations: +#' \eqn{\epsilon_{t,i} \sim N(meanlog_i, sdlog_i^2)}. +#' 2. Build the AR(1) process: +#' \eqn{x_{t,i} = \rho_i x_{t-1,i} + \sqrt{1 - \rho_i^2} \epsilon_{t,i}}, +#' with \eqn{x_{1,i} = \epsilon_{1,i}}. #' 3. Optionally apply bias correction on the log scale, then exponentiate: -#' y_{t,i} = exp(x_{t,i} - 0.5 * sdlog_i^2) (if bias.correct = TRUE). +#' \eqn{y_{t,i} = \exp(x_{t,i} - 0.5 sdlog_i^2)} +#' (if bias.correct = TRUE). #' #' @author The FLR Team #' diff --git a/man/Extract.Rd b/man/Extract.Rd index 6041fe3d..73db0968 100644 --- a/man/Extract.Rd +++ b/man/Extract.Rd @@ -116,9 +116,9 @@ dimension ('params' or 'quant'), and are provided to be used specially in formulas. } \section{Generic function}{ - \describe{ \item{}{\link{x,i,j,drop}} -\item{}{[<-(x,i,j,value)} \item{}{[[<-(x,i,j,value)} -\item{}{\$<-(x,name,value)} } + \describe{ \item{\code{[}}{\link{x,i,j,drop}} +\item{\code{[<-}}{[<-(x,i,j,value)} \item{\code{[[<-}}{[[<-(x,i,j,value)} +\item{\code{\$<-}}{\$<-(x,name,value)} } } \examples{ diff --git a/man/datasets.Rd b/man/datasets.Rd index da8c8c6e..17bb3363 100644 --- a/man/datasets.Rd +++ b/man/datasets.Rd @@ -13,7 +13,7 @@ Example datasets for the classes defined in FLCore. } \details{ -\itemize{ +\describe{ \item{\code{ple4}, \code{\link{FLStock}}}{A dataset for North Sea (ICES Area IV) plaice. Catch, landings, discards, natural mortality, weight-at-age and maturity, together with the VPA estimated abundances and fishing mortalities.} diff --git a/man/metrics.Rd b/man/metrics.Rd index 812acb3d..fce23774 100644 --- a/man/metrics.Rd +++ b/man/metrics.Rd @@ -69,7 +69,7 @@ metrics(ple4.biol, PG=function(x) n(x)[10,]) metrics(ple4.biol, metrics=list(PG=function(x) n(x)[10,])) } \seealso{ -\link{FLComp}, link{FLStock}, \link{FLBiol} +\link{FLComp}, \link{FLStock}, \link{FLBiol} } \author{ The FLR Team diff --git a/man/rlnormar1.Rd b/man/rlnormar1.Rd index 2e3073b2..8d04ca8e 100644 --- a/man/rlnormar1.Rd +++ b/man/rlnormar1.Rd @@ -51,11 +51,14 @@ on the log-scale so that the resulting series have the requested The simulation proceeds as follows: \enumerate{ -\item Draw independent normal innovations: eps_{t,i} ~ N(meanlog_i, sdlog_i^2). -\item Build the AR(1) process: x_{t,i} = rho_i * x_{t-1,i} + sqrt(1 - rho_i^2) * eps_{t,i}, -with x_{1,i} = eps_{1,i}. +\item Draw independent normal innovations: +\eqn{\epsilon_{t,i} \sim N(meanlog_i, sdlog_i^2)}. +\item Build the AR(1) process: +\eqn{x_{t,i} = \rho_i x_{t-1,i} + \sqrt{1 - \rho_i^2} \epsilon_{t,i}}, +with \eqn{x_{1,i} = \epsilon_{1,i}}. \item Optionally apply bias correction on the log scale, then exponentiate: -y_{t,i} = exp(x_{t,i} - 0.5 * sdlog_i^2) (if bias.correct = TRUE). +\eqn{y_{t,i} = \exp(x_{t,i} - 0.5 sdlog_i^2)} +(if bias.correct = TRUE). } } \examples{ From cbe9d6cdbf61bebb75c326c21db948387b0607db Mon Sep 17 00:00:00 2001 From: Iago Mosqueira Date: Mon, 9 Nov 2026 16:23:48 +0100 Subject: [PATCH 3/3] Fix Rd markup via roxygen sources Make the roxygen comments the source of the Rd fixes rather than editing man/*.Rd by hand: - FLArray.R: label Extract generic-function items and wrap signatures in \code{} so they are not auto-linked to non-existent topics. - Regenerate Rd from roxygen (rlnormar1 now uses \eqn{} for formulas). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- R/FLArray.R | 6 +++--- man/Extract.Rd | 6 +++--- man/rlnormar1.Rd | 12 +++++++++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/R/FLArray.R b/R/FLArray.R index 690f9ba1..69729ffa 100644 --- a/R/FLArray.R +++ b/R/FLArray.R @@ -133,9 +133,9 @@ setquant <- function(x, value) { #' @rdname Extract #' @aliases [,FLArray,ANY,ANY,ANY-method #' @docType methods -#' @section Generic function: \describe{ \item{\code{[}}{[x,i,j,drop]} -#' \item{\code{[<-}}{[<-(x,i,j,value)} \item{\code{[[<-}}{[[<-(x,i,j,value)} -#' \item{\code{\$<-}}{\$<-(x,name,value)} } +#' @section Generic function: \describe{ \item{\code{[}}{\code{[x,i,j,drop]}} +#' \item{\code{[<-}}{\code{[<-(x,i,j,value)}} \item{\code{[[<-}}{\code{[[<-(x,i,j,value)}} +#' \item{\code{\$<-}}{\code{\$<-(x,name,value)}} } #' @param x object from which to extract or replace element(s) #' @param i,j,k,l,m,n indices specifying elements to extract or replace on any of the six dimensions. #' @param ... indices specifying elements to extract or replace by dimension name. diff --git a/man/Extract.Rd b/man/Extract.Rd index 73db0968..9e0d6c49 100644 --- a/man/Extract.Rd +++ b/man/Extract.Rd @@ -116,9 +116,9 @@ dimension ('params' or 'quant'), and are provided to be used specially in formulas. } \section{Generic function}{ - \describe{ \item{\code{[}}{\link{x,i,j,drop}} -\item{\code{[<-}}{[<-(x,i,j,value)} \item{\code{[[<-}}{[[<-(x,i,j,value)} -\item{\code{\$<-}}{\$<-(x,name,value)} } + \describe{ \item{\code{[}}{\code{[x,i,j,drop]}} +\item{\code{[<-}}{\code{[<-(x,i,j,value)}} \item{\code{[[<-}}{\code{[[<-(x,i,j,value)}} +\item{\code{\$<-}}{\code{\$<-(x,name,value)}} } } \examples{ diff --git a/man/rlnormar1.Rd b/man/rlnormar1.Rd index 8d04ca8e..294265e1 100644 --- a/man/rlnormar1.Rd +++ b/man/rlnormar1.Rd @@ -10,7 +10,9 @@ rlnormar1( sdlog = 1, rho = 0, years, - bias.correct = FALSE + quant = "age", + bias.correct = FALSE, + initlog = NULL ) } \arguments{ @@ -29,9 +31,14 @@ Recycled to length \code{n} if necessary.} \item{years}{Integer or character vector. Years (time dimension) for the returned FLQuant (length determines number of time steps).} +\item{quant}{Name of the first dimension, \code{quant}. Defaults to 'age'.} + \item{bias.correct}{Logical. If TRUE (default FALSE) subtract 0.5 * sdlog^2 from the log-series before exponentiation to correct for the lognormal bias.} + +\item{initlog}{The mean in log space of the previous process to use as +starting point.} } \value{ An object of class FLQuant with dimensions year x iter containing @@ -48,6 +55,9 @@ parameter \code{rho}, and finally exponentiates the series. If \code{bias.correct = TRUE} the log-normal bias (0.5 * sdlog^2) is removed on the log-scale so that the resulting series have the requested \code{meanlog} on the log-scale. +When \code{initlog} is set, its value is used as starting point for the process, +as mean for year - 1, so that it transitions from that value to meanlog +following the given autocorrelation. The simulation proceeds as follows: \enumerate{