You can use the import_package
function in the package (and not the one on CRAN, its different!).
Then the following locally installs the package:
modules::import_packge('pkg', attach = TRUE)
Alternatively and potentially closer to what you really want to do, you can use it like this:
pgk = modules::import_package('pkg')
Now the package is not connected at all, and its exported objects can be accessed via pkg$obj
. This is somewhat similar to the basic Rs loadNamespace
function, but significantly more behind the scenes.
Finally, consider not putting your helper code in a package at all, but rather distributing it as a module. This is still what the package was designed for. So instead of creating a package, just distribute your helper.r
file (or folder), and then use it like this:
helper = modules::import('helper')
See README and vignette for a detailed description.
source share