Analogously, to setDoPar(), the setDoSeq() function attempts to undo partially set variables in case there's an error;
|
setDoSeq <- function(fun, data=NULL, info=function(data, item) NULL) { |
|
tryCatch( |
|
{ |
|
assign('seqFun', fun, pos=.foreachGlobals, inherits=FALSE) |
|
assign('seqData', data, pos=.foreachGlobals, inherits=FALSE) |
|
assign('seqInfo', info, pos=.foreachGlobals, inherits=FALSE) |
|
}, error = function(e) { |
|
if (exists('fun', where=.foreachGlobals, inherits=FALSE)) |
|
remove('fun', envir = .foreachGlobals) |
|
if (exists('data', where=.foreachGlobals, inherits=FALSE)) |
|
remove('data', envir = .foreachGlobals) |
|
if (exists('info', where=.foreachGlobals, inherits=FALSE)) |
|
remove('info', envir = .foreachGlobals) |
|
e |
|
}) |
|
} |
|
|
However, due to what looks like a cut'n'paste mistake from setDoPar(), setDoSeq() removes the wrong variables.
Analogously, to
setDoPar(), thesetDoSeq()function attempts to undo partially set variables in case there's an error;foreach/R/setDoSeq.R
Lines 31 to 47 in 731cff6
However, due to what looks like a cut'n'paste mistake from
setDoPar(),setDoSeq()removes the wrong variables.