I understand multicore
is deprecated as of R version 2.14 and I was advised to start using the package parallel
which comes built into the base of R 3.0.
Going through the documentation of parallel
, I found that there are mainly two functions to call parallel
and collect
for example:
p <- parallel(1:10)
q <- parallel(1:20)
collect(list(p, q)) # wait for jobs to finish and collect all results
Since I'm not very familiar with the details of parallel computing, I've always used multicore's
mclapply
out of the box in my code. I wondering how I could take advantage of the new parallel
package similarly to mclapply
.
Cheers
As mentioned by @Ben Bolker, the mclapply
is now integrated into R's base as of 3.0. Just load the package parallel
. No need to have multicore
require(parallel)
mclapply(1:30, rnorm)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With