Skip to content

Commit 1c629d8

Browse files
committed
foreach no longer needed
1 parent a5a681f commit 1c629d8

File tree

7 files changed

+5
-34
lines changed

7 files changed

+5
-34
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ VignetteBuilder: knitr
2121
Depends:
2222
R (>= 3.5.0)
2323
Imports:
24-
foreach,
2524
methods,
2625
parallel,
2726
dplyr,

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export(rmvt)
6565
export(rtruncate)
6666
export(runArraySimulation)
6767
export(runSimulation)
68-
import(foreach)
6968
import(methods)
7069
import(parallel)
7170
import(stats)

R/SimDesign.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' @aliases SimDesign-package
2424
#' @title Structure for Organizing Monte Carlo Simulation Designs
2525
#' @author Phil Chalmers \email{rphilip.chalmers@@gmail.com}
26-
#' @import foreach methods parallel stats
26+
#' @import methods parallel stats
2727
#' @importFrom sessioninfo session_info
2828
#' @importFrom RPushbullet pbPost
2929
#' @importFrom graphics abline

R/analysis.R

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,6 @@ Analysis <- function(Functions, condition, replications, fixed_objects, cl, MPI,
7070
if(MPI){
7171
stop('MPI structure no longer supported. Please use the parallel = \"future" approach',
7272
call. = FALSE)
73-
# i <- 1L
74-
# results <- try(foreach(i=1L:replications, .export=export_funs, .packages=packages,
75-
# .options.mpi=.options.mpi) %dopar%
76-
# mainsim(i, condition=condition, generate=Functions$generate,
77-
# analyse=Functions$analyse, fixed_objects=fixed_objects, load_seed=load_seed,
78-
# max_errors=max_errors, save=save,
79-
# store_Random.seeds=store_Random.seeds,
80-
# save_seeds=save_seeds, save_seeds_dirname=save_seeds_dirname,
81-
# save_results_out_rootdir=save_results_out_rootdir,
82-
# store_warning_seeds=store_warning_seeds,
83-
# include_replication_index=include_replication_index,
84-
# warnings_as_errors=warnings_as_errors, allow_na=allow_na, allow_nan=allow_nan,
85-
# use_try=use_try, allow_gen_errors=allow_gen_errors), TRUE)
8673
} else {
8774
if(!is.null(seed)) parallel::clusterSetRNGStream(cl=cl, seed[condition$ID])
8875
results <- if(progress){

R/runSimulation.R

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,6 @@
399399
#' For Windows OS this defaults to \code{"PSOCK"}, otherwise \code{"SOCK"} is selected
400400
#' (suitable for Linux and Mac OSX). This is ignored if the user specifies their own \code{cl} object}
401401
#'
402-
# \item{\code{MPI}}{logical (default is \code{FALSE}); use the \code{foreach} package in a
403-
# form usable by MPI to run simulation in parallel on a cluster? }
404-
#'
405402
#' \item{\code{print_RAM}}{logical (default is \code{TRUE}); print the amount of RAM
406403
#' used throughout the simulation? Set to \code{FALSE} if unnecessary or if the call to
407404
#' \code{\link{gc}} is unnecessarily time consuming}
@@ -426,11 +423,6 @@
426423
#' See \code{\link{runArraySimulation}} for the input specifications.
427424
#' }
428425
#'
429-
# \item{\code{.options.mpi}}{list of arguments passed to \code{foreach()} to control the MPI execution
430-
# properties. Only used when \code{MPI = TRUE}}
431-
#'
432-
#'
433-
#'
434426
#' }
435427
#'
436428
#' @param save_details a list pertaining to information regarding how and where files should be saved
@@ -1342,7 +1334,7 @@ runSimulation <- function(design, replications, generate, analyse, summarise,
13421334
parallel::parSapply(cl, 1L:(length(cl)*2),
13431335
function(ind, packages) load_packages(packages),
13441336
packages=packages)
1345-
} # foreach() doesn't like load_packages()
1337+
}
13461338
} else {
13471339
future.apply::future_lapply(1L:(future::nbrOfWorkers()*2),
13481340
function(ind, packages) load_packages(packages),
@@ -1355,7 +1347,7 @@ runSimulation <- function(design, replications, generate, analyse, summarise,
13551347
} else if(parallel){
13561348
try(table(parallel::parSapply(cl, rep(tmp[i], each=length(cl)*2),
13571349
get_packages)))
1358-
} else "" # for foreach()
1350+
}
13591351
if(tmp[i] == 'stats') next
13601352
if(length(packs) > 1L)
13611353
message(sprintf('Warning message:\nVersions of %s differ across clusters: %s',

man/runSimulation.Rd

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/MultipleAnalyses.Rmd

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ res <- structure(list(sample_size = c(250, 500, 1000, 250, 500, 1000
324324
"coda", "codetools", "crayon", "curl", "datawizard",
325325
"DBI", "dcurver", "Deriv", "digest", "dplyr", "effectsize",
326326
"ellipsis", "emmeans", "estimability", "evaluate", "fansi",
327-
"foreach", "generics", "glue", "GPArotation", "htmltools",
327+
"generics", "glue", "GPArotation", "htmltools",
328328
"insight", "iterators", "jsonlite", "knitr", "lattice",
329329
"lavaan", "lifecycle", "magrittr", "MASS", "Matrix",
330330
"mgcv", "mirt", "mnormt", "multcomp", "mvtnorm", "nlme",
@@ -369,7 +369,6 @@ res <- structure(list(sample_size = c(250, 500, 1000, 250, 500, 1000
369369
"C:/R/R-4.0.2/library/dplyr", "C:/R/R-4.0.2/library/effectsize",
370370
"C:/R/R-4.0.2/library/ellipsis", "C:/R/R-4.0.2/library/emmeans",
371371
"C:/R/R-4.0.2/library/estimability", "C:/R/R-4.0.2/library/evaluate",
372-
"C:/R/R-4.0.2/library/fansi", "C:/R/R-4.0.2/library/foreach",
373372
"C:/R/R-4.0.2/library/generics", "C:/R/R-4.0.2/library/glue",
374373
"C:/R/R-4.0.2/library/GPArotation", "C:/R/R-4.0.2/library/htmltools",
375374
"C:/R/R-4.0.2/library/insight", "C:/R/R-4.0.2/library/iterators",
@@ -406,7 +405,6 @@ res <- structure(list(sample_size = c(250, 500, 1000, 250, 500, 1000
406405
"C:/R/R-4.0.2/library/dplyr", "C:/R/R-4.0.2/library/effectsize",
407406
"C:/R/R-4.0.2/library/ellipsis", "C:/R/R-4.0.2/library/emmeans",
408407
"C:/R/R-4.0.2/library/estimability", "C:/R/R-4.0.2/library/evaluate",
409-
"C:/R/R-4.0.2/library/fansi", "C:/R/R-4.0.2/library/foreach",
410408
"C:/R/R-4.0.2/library/generics", "C:/R/R-4.0.2/library/glue",
411409
"C:/R/R-4.0.2/library/GPArotation", "C:/R/R-4.0.2/library/htmltools",
412410
"C:/R/R-4.0.2/library/insight", "C:/R/R-4.0.2/library/iterators",
@@ -513,7 +511,7 @@ res <- structure(list(sample_size = c(250, 500, 1000, 250, 500, 1000
513511
"bayestestR", "cli", "cluster", "coda", "codetools", "crayon",
514512
"curl", "datawizard", "DBI", "dcurver", "Deriv", "digest",
515513
"dplyr", "effectsize", "ellipsis", "emmeans", "estimability",
516-
"evaluate", "fansi", "foreach", "generics", "glue", "GPArotation",
514+
"evaluate", "fansi", "generics", "glue", "GPArotation",
517515
"htmltools", "insight", "iterators", "jsonlite", "knitr",
518516
"lattice", "lavaan", "lifecycle", "magrittr", "MASS", "Matrix",
519517
"mgcv", "mirt", "mnormt", "multcomp", "mvtnorm", "nlme",

0 commit comments

Comments
 (0)