@@ -328,9 +328,9 @@ future_obj <- future::future(f3()) # Evaluate in parallel
328328## Combine together
329329
330330``` {r future-planning}
331- #' `multisession` using two cores:
332- #' Default setup uses the max # of cores
333- #' Print # of cores to use with `future::availableCores()`
331+ # `multisession` using two cores:
332+ # Default setup uses the max # of cores
333+ # Print # of cores to use with `future::availableCores()`
334334future::plan(future::multisession, workers = 2)
335335
336336future_obj <- future::future(f3()) # Evaluate in parallel
@@ -387,8 +387,8 @@ x |> furrr::future_map(your_fun)
387387
388388``` {r foreach-example1}
389389library(foreach)
390- #' By default return a list where each element
391- #' is an output from each iteration
390+ # By default return a list where each element
391+ # is an output from each iteration
392392res <- foreach::foreach (i = 1:3) %do% {
393393 i + 1
394394}
@@ -438,8 +438,8 @@ library(doFuture)
438438doFuture::registerDoFuture() # Register cores
439439future::plan(future::multisession, workers = 2)
440440
441- #' Compute the mean while trimming values less than 0.1
442- #' %dopar% automatically detect parallel adapter
441+ # Compute the mean while trimming values less than 0.1
442+ # %dopar% automatically detect parallel adapter
443443cutoff <- 5
444444y <- foreach(i = 1:10, .combine = "c") %dopar% {
445445 if (i < cutoff) return(i)
@@ -496,6 +496,8 @@ all(out1 == out2)
496496
497497## Random number generation in ` foreach `
498498
499+ * Rreproducible parallel results in ` foreach ` with ` doRNG `
500+
499501``` {r rng-foreach}
500502library(foreach)
501503library(doRNG) # Random number generation in foreach
0 commit comments