How to export multiple function or packages in foreach loop in "R" -


i'm trying decrease run time of code using doparallel package in r.

i'm calling function awareratesir packages used in body of function. error

could not find function "vcount" and..

i know vcount function of package igraph used in awareratesir) it's not one. how can solve problem? i've thought should pass packages name used in function awareratesir don't know how cant export multiple function in foreach or how can export multiple package name.

this code:

tp<-foreach(i=1:iter,  .inorder = false, .export = "awareratesir",           .packages = "igraph", .packages="doparallel")%dopar%{ tp <- awareratesir(graphcontact, graphcom,state) return(tp) } 

if don't pass these packages error states function unknown if pass packages error:

error in foreach(i = 1:iter, .inorder = false, .export = "awareratesir", : formal argument ".packages" matched multiple actual arguments"

thanks in advance

you should pass packages required, using c function, below :

tp<-foreach(i=1:iter,  .inorder = false, .export = "awareratesir",           .packages = c("igraph", "doparallel"))%dopar%{ tp <- awareratesir(graphcontact, graphcom,state) return(tp) } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -