I have a parallelized code in R that uses foreach()
ls<-foreach(reps = 1:1000) %dopar% {
....
For each loop I would like to load a different dataset, ideally:
ls<-foreach(reps = 1:1000) %dopar% {
name<-paste0("dataset",reps,'.Rdata',sep="",collapse=NULL)
load(name)
...
So I would like to use the "reps" index of foreach
which goes from 1:1000
and load each dataset (dataset1, dataset2...dataset1000) in each iteration of the loop.
Is this possible to do somehow?