rforeachpackagedomcdoparallel

how to use %dopar% when only import foreach in DESCRIPTION of a package


How to avoid "could not find function "%dopar%"" in a function of a package when only imports (not depends) foreach in DESCRIPTION of a package? is there a way like foreach::%dopar% as I use foreach::foreach in function? Thank you.

Code like:

In function

foreach::foreach(1:9) %dopar% {

...}

In DESCRIPTION

Imports: 
    Matrix,
    parallel,
    foreach,
   doParallel

Solution

  • You need to use backticks: foreach::`%dopar%` (or quotes foreach::"%dopar%" will also work).