You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(RMINC)
#df, formulaString defined
form <- as.formula(formulaString)
sa_model <- vertexLm(form, data=df)
sa_es <- vertexEffectSize(sa_model)
This fails:
library(RMINC)
library(parallel)
#df, formulaMatrix defined
#df is data frame
#formulaMatrix contains formula strings to loop over
cl <- makeForkCluster(nNodes)
parApply( cl, formulaMatrix, 1, function(formulaString)
{
form <- as.formula(formulaString)
sa_model <- vertexLm(form, data=df)
sa_es <- vertexEffectSize(sa_model)
} )
Error in checkForRemoteErrors(val) :
18 nodes produced errors; first error: object 'form' not found
The error occurs in line 87 of RMINC's effectsize.R. The modification shown below seems to alleviate the problem, at least in this particular use case. However, I'm not certain why these behave differently because, if I understand the R docs correctly, these two calls should be equivalent since eval defaults to the parent environment anyways.
# effectsize.R line 87. This fails when vertexEffectSize() is executed in parallel by parLapply().
mod_mat <- eval(model_call)
# Mod to force evaluation in parent environment
mod_mat <- eval.parent(model_call,n=1)
The text was updated successfully, but these errors were encountered:
This works:
This fails:
The error occurs in line 87 of RMINC's effectsize.R. The modification shown below seems to alleviate the problem, at least in this particular use case. However, I'm not certain why these behave differently because, if I understand the R docs correctly, these two calls should be equivalent since eval defaults to the parent environment anyways.
The text was updated successfully, but these errors were encountered: