diff --git a/R/R/model.R b/R/R/model.R index 446c54f75..eb448b802 100644 --- a/R/R/model.R +++ b/R/R/model.R @@ -935,13 +935,11 @@ robyn_mmm <- function(InputCollect, arrange(.data$nrmse) %>% as_tibble() - # if (hyper_fixed) { resultCollect[["xDecompVec"]] <- bind_rows( lapply(resultCollectNG, function(x) { bind_rows(lapply(x, function(y) y$xDecompVec)) }) ) %>% - arrange(.data$solID, .data$ds) %>% as_tibble() # resultCollect[["xDecompVecImmediate"]] <- bind_rows( # lapply(resultCollectNG, function(x) { @@ -957,7 +955,6 @@ robyn_mmm <- function(InputCollect, # ) %>% # arrange(.data$nrmse, .data$ds) %>% # as_tibble() - # } resultCollect[["xDecompAgg"]] <- bind_rows( lapply(resultCollectNG, function(x) { diff --git a/R/R/outputs.R b/R/R/outputs.R index fec204106..8c3eaab1f 100644 --- a/R/R/outputs.R +++ b/R/R/outputs.R @@ -86,6 +86,13 @@ robyn_outputs <- function(InputCollect, OutputModels, pareto_fronts <- pareto_results$pareto_fronts allSolutions <- pareto_results$pareto_solutions + # Reduce the size of xDecompVec with only pareto-front models + temp <- OutputModels[names(OutputModels) %in% paste0("trial", seq(OutputModels$trials))] + temp2 <- lapply(temp, function(x) filter(x$resultCollect$xDecompVec, .data$solID %in% allSolutions)) + for (i in seq(OutputModels$trials)) { + OutputModels[[paste0("trial", i)]]$resultCollect$xDecompVec <- temp2[[i]] + } + ##################################### #### Gather the results into output object