From 6a25ac23c38f155d497757dd47ba410d54aae2d5 Mon Sep 17 00:00:00 2001 From: Iago Mosqueira Date: Fri, 6 Dec 2024 18:36:38 +0100 Subject: [PATCH] Removed iterMedians(FLStock), bad idea, added it for FLQuants --- DESCRIPTION | 2 +- R/FLQuants.R | 10 ++++++++++ R/FLS.R | 4 ++-- R/FLStock.R | 15 --------------- R/FLStockR.R | 12 ------------ 5 files changed, 13 insertions(+), 30 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a3edf6d1..e09f93f5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: FLCore Title: Core Package of FLR, Fisheries Modelling in R -Version: 2.6.20.9309 +Version: 2.6.20.9310 Authors@R: c( person("Iago", "Mosqueira", email = "iago.mosqueira@wur.nl", role = "cre", comment=c(c(ORCID = "0000-0002-3252-0591"))), diff --git a/R/FLQuants.R b/R/FLQuants.R index b8e7b81d..0c76fe5c 100644 --- a/R/FLQuants.R +++ b/R/FLQuants.R @@ -319,3 +319,13 @@ setMethod("merge", signature(x="FLQuants", y="FLQuants"), ) # }}} + +# iterMedians {{{ +setMethod("iterMedians", signature(x="FLQuants"), + function(x) { + + res <- lapply(x, iterMedians) + + return(res) +}) +# }}} diff --git a/R/FLS.R b/R/FLS.R index a27a32a4..5303f5d1 100644 --- a/R/FLS.R +++ b/R/FLS.R @@ -11,8 +11,8 @@ #' computeLandings,FLStockLen-method setMethod("computeLandings", signature(object="FLS"), function(object, na.rm=TRUE) { - res <- quantSums(landings.n(object) * landings.wt(object), na.rm=na.rm) - return(res) + res <- quantSums(landings.n(object) * landings.wt(object), na.rm=na.rm) + return(res) } ) # }}} diff --git a/R/FLStock.R b/R/FLStock.R index e9b9f43d..9cbb9277 100644 --- a/R/FLStock.R +++ b/R/FLStock.R @@ -2350,21 +2350,6 @@ setMethod("ageopt", signature(object="FLStock"), ) # }}} -# iterMedians {{{ -setMethod("iterMedians", signature(x="FLStock"), - function(x) { - - res <- qapply(x, iterMedians) - - landings(res) <- iterMedians(landings(x)) - discards(res) <- iterMedians(discards(x)) - catch(res) <- iterMedians(catch(x)) - stock(res) <- iterMedians(stock(x)) - - return(res) -}) -# }}} - # update(FLStock, ...) {{{ setMethod("update", signature(object="FLStock"), diff --git a/R/FLStockR.R b/R/FLStockR.R index bf2aa049..4b136339 100644 --- a/R/FLStockR.R +++ b/R/FLStockR.R @@ -208,18 +208,6 @@ setAs('FLStockR', 'FLStock', }) # }}} -# iterMedians {{{ -setMethod("iterMedians", signature(x="FLStockR"), - function(x) { - - res <- callNextMethod() - - refpts(res) <- iterMedians(refpts(x)) - - return(res) -}) -# }}} - # depletion {{{ setMethod("depletion", signature(x="FLStockR"),