Function object to call in the new R process.
The function should be self-contained and only refer to
other functions and use variables explicitly from other packages
using the ::
notation. The environment of the function
is set to .GlobalEnv
before passing it to the child process.
Because of this, it is good practice to create an anonymous
function and pass that to callr
, instead of passing
a function object from a (base or other) package. In particular
r(.libPaths)
does not work, because .libPaths
is defined in a special
environment, but
r(function() .libPaths())
works just fine.