Skip to content
This repository was archived by the owner on May 2, 2024. It is now read-only.

Commit 83adfd1

Browse files
last edit (#6)
1 parent 4bb4148 commit 83adfd1

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

presentation.Rmd

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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()`
334334
future::plan(future::multisession, workers = 2)
335335
336336
future_obj <- future::future(f3()) # Evaluate in parallel
@@ -387,8 +387,8 @@ x |> furrr::future_map(your_fun)
387387

388388
```{r foreach-example1}
389389
library(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
392392
res <- foreach::foreach (i = 1:3) %do% {
393393
i + 1
394394
}
@@ -438,8 +438,8 @@ library(doFuture)
438438
doFuture::registerDoFuture() # Register cores
439439
future::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
443443
cutoff <- 5
444444
y <- 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}
500502
library(foreach)
501503
library(doRNG) # Random number generation in foreach

presentation.pdf

-104 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)