View source: R/mean_parallel_compute.R
mean_parallel_compute | R Documentation |
Constructs an example showing how to use foreach
, iterators
, and
doParallel
to perform a parallel computation with a C++ function written
using Rcpp.
mean_parallel_compute(
n,
mean = 0,
sd = 1,
n_sim = 1000,
n_cores = parallel::detectCores()
)
n |
Number of Observations |
mean |
Center of Normal Distribution |
sd |
Standard Deviation of Normal Distribution |
n_sim |
Number of Simulations to Run |
n_cores |
Number of CPU cores to use in parallelization task. |
The mean_parallel_compute()
function performs a bootstrap computation in
parallel of a mean value from the normal distribution.
A vector
of length n_sim
containing the mean for each distribution.
# Compute the mean on 1000 observations with 50 replications across
# 2 CPUs.
mean_parallel_compute(1000, n_sim = 50, n_cores = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.