Problem solved! `%dopar%` <- foreach::`%dopar%`
One of my functions does parallel processing with "doParallel" and > "foreach". "foreach" is a dependency to "doParallel". My R package keeps > failing, because %dopar% is not recognized as a function. I tried > %foreach::dopar%, %parallel::dopar% , %doParallel::dopar%, and > %iterators::dopar%. It didn't help! > > In DESCRIPTION, I have: > > Suggests: > dpParallel (>= 1.0.14) > > I want it to be "suggested" rather than a dependency. > Following is the example function. To make sure that it is working, try > library("doParallel"). > > myfunc = function(n) { > if(requireNamespace("doParallel", quietly=TRUE)) > { > cl = parallel::makeCluster(2) > doParallel::registerDoParallel(cl) > Q = foreach::foreach(i=1:n, .combine='cbind') %dopar% rep(i, 5) > parallel::stopCluster(cl) > return(Q) > } else { > print("Package doParallel is required.") > } > } > > Your help is really appreciated! > [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel