| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/libpaths.R |
| 3 |
\name{with_libpaths} |
| 4 |
\alias{with_libpaths} |
| 5 |
\alias{local_libpaths} |
| 6 |
\title{Library paths} |
| 7 |
\usage{ |
| 8 |
with_libpaths(new, code, action = "replace") |
| 9 |
|
| 10 |
local_libpaths(new = list(), action = "replace", .local_envir = parent.frame()) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{new}{\verb{[character]}\cr New library paths} |
| 14 |
|
| 15 |
\item{code}{\code{[any]}\cr Code to execute in the temporary environment} |
| 16 |
|
| 17 |
\item{action}{\verb{[character(1)]}\cr should new values \code{"replace"}, \code{"prefix"} or |
| 18 |
\code{"suffix"} existing paths.} |
| 19 |
|
| 20 |
\item{.local_envir}{\verb{[environment]}\cr The environment to use for scoping.} |
| 21 |
} |
| 22 |
\value{ |
| 23 |
\code{[any]}\cr The results of the evaluation of the \code{code} |
| 24 |
argument. |
| 25 |
} |
| 26 |
\description{ |
| 27 |
Temporarily change library paths. |
| 28 |
} |
| 29 |
\examples{ |
| 30 |
.libPaths() |
| 31 |
new_lib <- tempfile() |
| 32 |
dir.create(new_lib) |
| 33 |
with_libpaths(new_lib, print(.libPaths())) |
| 34 |
unlink(new_lib, recursive = TRUE) |
| 35 |
} |
| 36 |
\seealso{ |
| 37 |
\code{\link{withr}} for examples |
| 38 |
|
| 39 |
\code{\link[=.libPaths]{.libPaths()}} |
| 40 |
|
| 41 |
Other libpaths: |
| 42 |
\code{\link{with_temp_libpaths}()} |
| 43 |
} |
| 44 |
\concept{libpaths} |