powered by
Temporarily change library paths.
with_libpaths(new, code, action = "replace")local_libpaths(new = list(), action = "replace", .local_envir = parent.frame())
local_libpaths(new = list(), action = "replace", .local_envir = parent.frame())
[any] The results of the evaluation of the code
[any]
code
argument.
[character] New library paths
[character]
[any] Code to execute in the temporary environment
[character(1)] should new values "replace", "prefix" or "suffix" existing paths.
[character(1)]
"replace"
"prefix"
"suffix"
[environment] The environment to use for scoping.
[environment]
withr for examples
withr
.libPaths()
Other libpaths: with_temp_libpaths()
with_temp_libpaths()
.libPaths() new_lib <- tempfile() dir.create(new_lib) with_libpaths(new_lib, print(.libPaths())) unlink(new_lib, recursive = TRUE)
Run the code above in your browser using DataLab