To be able to unload properly a package, all the packages that depend even indirectly on it should be unloaded first.
Usage
pkg_unload(
pkg_or_name,
src_pkgs = get_srcpkgs(),
dry_run = FALSE,
loaded = loadedNamespaces(),
quiet = FALSE
)Value
a data frame of the unloaded package names, and whether they were attached, invisibly or NULL if the package is not loaded
Examples
root <- tempfile()
pkg <- setup_and_get_dummy_srcpkg(root)
reset(root)
pkg_load(pkg)
#> executing unload on dummy.srcpkg
#> executing load on dummy.srcpkg
#> ℹ Updating dummy.srcpkg documentation
#> First time using roxygen2. Upgrading automatically...
#> ℹ Setting RoxygenNote to "7.3.3"
#> ℹ Loading dummy.srcpkg
#> Writing NAMESPACE
#> ℹ Loading dummy.srcpkg
pkg_unload(pkg)
#> executing unload on dummy.srcpkg