Skip to content

Commit

Permalink
Update methods
Browse files Browse the repository at this point in the history
  • Loading branch information
iagomosqueira committed Apr 2, 2024
1 parent ccbf75f commit af3e6a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: FLCore
Title: Core Package of FLR, Fisheries Modelling in R
Version: 2.6.20.9002
Version: 2.6.20.9006
Authors@R: c(
person("Iago", "Mosqueira", email = "iago.mosqueira@wur.nl",
role = "cre", comment=c(c(ORCID = "0000-0002-3252-0591"))),
Expand Down
10 changes: 8 additions & 2 deletions R/FLComp.R
Original file line number Diff line number Diff line change
Expand Up @@ -887,10 +887,16 @@ setMethod("update", signature(object="FLComp"),
if(any(names(args) %in% c(NULL, character(1))))
stop("Object to assign to slots must be named")

# LOOP over value
for(i in names(args)) {

# GET dimnames to act on
dms <- setNames(dimnames(args[[i]]), letters[9:14])
# TODO: USE do.call
slot(object, i)[dms$i, dms$j, dms$k, dms$l, dms$m, dms$n] <- args[[i]]

# ASSIGN to subset of object the modified subset
object[dms$i, dms$j, dms$k, dms$l, dms$m, dms$n] <-
do.call(paste0(i, "<-"), list(do.call("[", c(list(object), dms)),
value=args[[i]]))
}

return(object)
Expand Down
5 changes: 5 additions & 0 deletions R/genericMethods.R
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,11 @@ setGeneric("distribution<-", function(object, ..., value)
setGeneric('combine', function(x, y, ...)
standardGeneric('combine'))

setMethod('combine', signature(x='NULL', y='NULL'),
function(x,y,...) {
return(NULL)
})

# jackknife
setGeneric("jackknife", function(object, ...)
standardGeneric("jackknife"))
Expand Down

0 comments on commit af3e6a8

Please sign in to comment.