Skip to content

Commit 762630f

Browse files
committed
add explanation about parallel computing code in Chapter 11
1 parent 7c831c2 commit 762630f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Chapter11.rmd

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ library(vars)
77
library(xlsx)
88
99
# load foreach and doParallel packages to do parallel computing.
10+
# I can do parallel computation using %dopar% binary operator in foreach package with parallel backend in doParallel package. I can get result far faster than when I used loop.
11+
# If I use %do% instead of %dopar%, I can't use parallel computation even if I don't need to designate '.packages' option in foreach function.
12+
# '.packages' option specifies the required R package to be loaded to use the function that I want to use repeatedly.
13+
# https://www.r-statistics.com/tag/r-parallel-computation/
14+
# This R version can't use doSMP package. Therefore I chose to use foreach and doParallel packages.
1015
library(foreach)
1116
library(doParallel)
1217
workers <- makeCluster(4) # My computer has 4 cores

0 commit comments

Comments
 (0)