# NOT RUN {
## The example assumes that a Redis server is running on the local host
## and standard port.
## 1. Open one or more 'worker' R sessions and run:
require('doRedis')
redisWorker('jobs')
## 2. Open another R session acting as a 'master' and run this simple
## sampling approximation of pi:
require('doRedis')
registerDoRedis('jobs')
foreach(j=1:10, .combine=sum, .multicombine=TRUE) \<!-- %dopar\\% -->
4 * sum((runif(1000000) ^ 2 + runif(1000000) ^ 2) < 1) / 10000000
removeQueue('jobs')
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab