dispose_packages {disposables}R Documentation

Get rid of temporary packages

Description

Get rid of temporary packages

Usage

dispose_packages(packages, unattach = TRUE, unload = unattach,
  delete = TRUE, delete_lib_dir = delete)

Arguments

packages

A list returned by make_packages.

unattach

Whether to unattach the packages.

unload

Whether to unload the packages. It is not possible to unload without unattaching.

delete

Whether to delete the installed packages from the lib_dir. If delete_lib_dir is TRUE, then this should be TRUE as well.

delete_lib_dir

Whether to delete the the whole lib_dir.

Examples

pkg <- make_packages(
  foo1 = { f <- function() print("hello!") ; d <- 1:10 },
  foo2 = { f <- function() print("hello again!") ; d <- 11:20 }
)

foo1::f()
foo2::f()
foo1::d
foo2::d

## Unattach only
dispose_packages(pkg, unload = FALSE, delete = FALSE)
"package:foo1" %in% search()
"foo1" %in% loadedNamespaces()
dir(pkg$lib_dir)

## Unload
dispose_packages(pkg, delete = FALSE)
"package:foo1" %in% search()
"foo1" %in% loadedNamespaces()
dir(pkg$lib_dir)

## Delete completely
dispose_packages(pkg)
"package:foo1" %in% search()
"foo1" %in% loadedNamespaces()
file.exists(pkg$lib_dir)

[Package disposables version 1.0.3 Index]