Skip to content

Commit 6644e6a

Browse files
committed
frame is needed
1 parent 63e33ec commit 6644e6a

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

R/runArraySimulation.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ runArraySimulation <- function(design, ..., replications,
298298
if(!is.null(control$save_seeds) && isTRUE(control$save_seeds))
299299
stop(c('save_seeds not supported for array jobs. If this is truely',
300300
' necessary use store_Random.seeds instead'))
301+
control$from.runArraySimulation <- TRUE
301302
rngkind <- RNGkind()
302303
RNGkind("L'Ecuyer-CMRG")
303304
on.exit(RNGkind(rngkind[1L]))

R/runSimulation.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,8 @@ runSimulation <- function(design, replications, generate, analyse, summarise,
12741274
on.exit(undebug(Functions[[debug]]), add = TRUE)
12751275
}
12761276
}
1277-
export_funs <- parent_env_fun()
1277+
export_funs <- if(!is.null(control$from.runArraySimulation))
1278+
parent_env_fun(3L) else parent_env_fun()
12781279
if(parallel){
12791280
if(!useFuture && is.null(cl)){
12801281
cl <- parallel::makeCluster(ncores, type=type)

R/util.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
.SIMDENV <- new.env(parent=emptyenv())
22

33
# return a character vector of functions defined in .GlobalEnv
4-
parent_env_fun <- function(){
5-
nms <- ls(envir = globalenv())
4+
parent_env_fun <- function(level=2){
5+
nms <- ls(envir = parent.frame(level))
66
is_fun <- sapply(nms, function(x, envir) is.function(get(x, envir=envir)),
7-
envir = globalenv())
7+
envir = parent.frame(level))
88
return(nms[is_fun])
99
}
1010

@@ -942,7 +942,7 @@ valid_control.list <- function()
942942
"store_warning_seeds", "include_replication_index", "include_reps", "try_all_analyse",
943943
"allow_na", "allow_nan", "type", "print_RAM", "max_time", "max_RAM",
944944
"tol", "summarise.reg_data", "rel.tol", "k.success", "interpolate.R", "bolster",
945-
"include_reps")
945+
"include_reps", 'from.runArraySimulation')
946946

947947
valid_save_details.list <- function()
948948
c("safe", "compname", "out_rootdir", "save_results_dirname", "save_results_filename",

0 commit comments

Comments
 (0)