I am trying to use the try() function to deal with errors that are occurring in my parallelised for loop:
results <- foreach (i = 1:2, .errorhand
You can use tryCatch and deal with the error appropriately. Here the error is ignored (returning NULL)
results <- foreach (i = 1:2) %dopar% {
res <- tryCatch({
myfun(i)
}, error=function(e) NULL)
}
or just using the builtin .errorhandling='remove' as you have, without the try should remove the errors already.