mc.run: multi-core run in R

mc.runR Documentation

multi-core run in R

Description

multi-core run in R

Details

This page would show how to run with multi-core in R.

Author(s)

Yuanzhen Lin <yzhlinscau@163.com>

References

Yuanzhen Lin. R & ASReml-R Statistics. China Forestry Publishing House. 2016

Examples

## 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)

yzhlinscau/AAfun0s documentation built on April 18, 2023, 4:11 p.m.