I'd like to make parallel processing in R by using packages 'doParallel' and 'foreach'. And, the idea is to make parallel only computations without any outcomes. What I've found looks like 'foreach' operator always return some kind of result that takes memory in the RAM. So, I need any help to have an empty result for parallel processing loops.
# 1. Packages
library(doParallel)
library(foreach)
# 2. Create and run app cluster
cluster_app <- makeCluster(detectCores())
registerDoParallel(cluster_app)
# 3. Loop with result
list_i <- foreach(i = 1:100) %dopar% {
print(i)
}
# 4. List is not empty
list_i
# 5. How make loop with empty 'list_i' ?
# TODO: make 'list' equal NULL or NA
# 6. Stop app cluster
stopCluster(cluster_app)