Skip to content

Commit

Permalink
delete assign() function and ref to .GlobalEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
berthetclement committed Aug 27, 2024
1 parent b2015bf commit e6443c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions R/aggregateResult.R
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,13 @@ parAggregateMCall <- function(opts,
}
}
LOLD_data[, isLOLD_cum := 100 * isLOLD_cum/sum(mcWeights)]
assign("LOLD_data", LOLD_data, envir = parent.env(environment()))
}
})

#browser()
# browser()
.addMessage(verbose, paste0("------- End Mc-all : ", type, " -------"))
.formatOutput( lapply(value, function(X)(Reduce(cbind, X))), struct)
outputlist <- .formatOutput( lapply(value, function(X)(Reduce(cbind, X))), struct)
list(outputlist, LOLD_data)
}, verbose = verbose, simplify = FALSE)


Expand All @@ -621,7 +621,7 @@ parAggregateMCall <- function(opts,
# Create grid folder####
.gridFolderCreation(opts, verbose)
# Create digest####
suppressWarnings(.writeDigestFile(opts, output, tmstp, linkTable, verbose, LOLD_data))
suppressWarnings(.writeDigestFile(opts, output[[1]], tmstp, linkTable, verbose, LOLD_data = output[[1]][[2]]))
}

mc_all <- file.path(opts$simDataPath, "mc-all")
Expand Down Expand Up @@ -1044,7 +1044,6 @@ aggregateResult <- function(opts,
.formatOutput <- function(out, struct){

# out <- lapply(value, function(X)(Reduce(cbind, X)))
# browser()
for(i in names(struct)){
if(is.null(nrow(struct[[i]]))){
struct[[i]] <- NULL
Expand Down
6 changes: 3 additions & 3 deletions R/showAliases.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ showAliases <- function(names = NULL) {
#'
#' @export
setAlias <- function(name, desc, select) {
if (!exists("varAliases", envir = pkgEnv)) {
assign("pkgEnv", list(), envir = pkgEnv)
}
if (!exists("varAliases", envir = pkgEnv))
message("varAliases is not defined and will be created")

pkgEnv$varAliases[[name]] <- list(desc = desc, select = select)

invisible(TRUE)
Expand Down

0 comments on commit e6443c7

Please sign in to comment.