instruments the R loaders to make them aware of source packages
Source:R/hack_r_loaders.R
hack_r_loaders.Rd
hacks library()
and loadNamespace()
using the base R tracer function trace()
.
library(pkg)
will basically call pkg_load(pkg)
if the source package pkg
is managed by srcpkgs
Package startup
At package startup (actually .OnAttach()
), hack_r_loaders()
will be automatically called to hack
the R loaders, UNLESS this is inhibited via the option srcpkgs.inhibit_r_loaders_hack
or the
environment variable SRCPKGS.INHIBIT_R_LOADERS_HACK
. You may set any value like TRUE, "TRUE", 1 or "1".
Examples
# \donttest{
# hack library
hack_r_loaders()
# unhack
unhack_r_loaders()
# prevent automatic hacking when srcpkgs is loaded
options(srcpkgs.inhibit_r_loaders_hack=TRUE)
# or
Sys.setenv(SRCPKGS.INHIBIT_R_LOADERS_HACK="1")
library(srcpkgs)
# }