diff --git a/DESCRIPTION b/DESCRIPTION index 67f1bcaa..515ff297 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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"))), diff --git a/R/FLComp.R b/R/FLComp.R index 1b10e002..4593db96 100644 --- a/R/FLComp.R +++ b/R/FLComp.R @@ -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) diff --git a/R/genericMethods.R b/R/genericMethods.R index d43832ba..211d7b0d 100644 --- a/R/genericMethods.R +++ b/R/genericMethods.R @@ -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"))