dispose_packages: Get rid of temporary packages

Description Usage Arguments Examples

Description

Get rid of temporary packages

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)

disposables documentation built on May 2, 2019, 7:55 a.m.