mc.run | R Documentation |
multi-core run in R
This page would show how to run with multi-core in R.
Yuanzhen Lin <yzhlinscau@163.com>
Yuanzhen Lin. R & ASReml-R Statistics. China Forestry Publishing House. 2016
## Not run:
code<-c('600519.ss','601398.ss')
# stock.get is the main function
# using lapply and stock.get
mm<-lapply(code, stock.get)
# using stock.get with multi-core
library(doParallel)
cl <- makePSOCKcluster(detectCores()-1)
registerDoParallel(cl)
## multi-core run here
mm1<-foreach(code=code) %dopar% stock.get(code)
stopCluster(cl)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.