From d5cfce1cfdb0b1471a9035460be31091949b3148 Mon Sep 17 00:00:00 2001 From: Iago Mosqueira Date: Tue, 11 Oct 2022 22:59:04 +0200 Subject: [PATCH] Avoid issues with harvest iters --- R/flxsa.R | 5 +++-- R/xsa.sa.R | 4 ++++ man/xsa.sa.Rd | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/R/flxsa.R b/R/flxsa.R index beb3ae5..1a67c12 100644 --- a/R/flxsa.R +++ b/R/flxsa.R @@ -159,7 +159,8 @@ setGeneric("FLXSA", function(stock, indices, ...) setMethod("FLXSA", signature(stock="FLStock", indices="FLIndex"), function(stock, indices, control=FLXSA.control(), diag.flag=TRUE) { - FLXSA(stock=stock, indices=FLIndices(indices), control=control, diag.flag=diag.flag) + FLXSA(stock=stock, indices=FLIndices(indices), control=control, + diag.flag=diag.flag) } ) @@ -291,7 +292,7 @@ setMethod("FLXSA", signature(stock="FLStock", indices="FLIndices"), } } - dimnames(res@harvest)$iter <- dimnames(harvest(stock))$iter + dimnames(res@harvest)$iter <- dimnames(stock.n(stock))$iter dimnames(res@stock.n)$iter <- dimnames(stock.n(stock))$iter res@harvest@units <- "f" diff --git a/R/xsa.sa.R b/R/xsa.sa.R index b5dbe48..d37ebbc 100644 --- a/R/xsa.sa.R +++ b/R/xsa.sa.R @@ -19,6 +19,10 @@ #' @param idx An FLIndices. #' #' @return A list containing the updated FLStock, and the tracking FLQuant. +#' @examples +#' data(ple4) +#' data(ple4.index) +#' xsa.sa(stk=ple4, idx=ple4.index, args=list(ay=2018), tracking=FLQuant()) xsa.sa <- function(stk, idx, args, tracking, ...) { diff --git a/man/xsa.sa.Rd b/man/xsa.sa.Rd index ed1cc13..8e10184 100644 --- a/man/xsa.sa.Rd +++ b/man/xsa.sa.Rd @@ -21,3 +21,8 @@ a module for FLXSA. As a flag for convergence, the returned tracking FLQuant contains the number of maximum number of iterations (maxit). } +\examples{ +data(ple4) +data(ple4.index) +xsa.sa(stk=ple4, idx=ple4.index, args=list(ay=2018), tracking=FLQuant()) +}