I need to convert a complex foreach loop into a parLapply function.
For simplicity I will use the following foreach loop:
library(foreach) library(doParall