File: with_path.Rd

package info (click to toggle)
r-cran-withr 2.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 528 kB
  • sloc: sh: 10; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,123 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/path.R
\name{with_path}
\alias{with_path}
\alias{local_path}
\title{PATH environment variable}
\usage{
with_path(new, code, action = "prefix")

local_path(new = list(), action = "prefix", .local_envir = parent.frame())
}
\arguments{
\item{new}{\verb{[character]}\cr New \code{PATH} entries}

\item{code}{\code{[any]}\cr Code to execute in the temporary environment}

\item{action}{\verb{[character(1)]}\cr Should new values \code{"replace"}, \code{"prefix"} or
\code{"suffix"} existing paths}

\item{.local_envir}{\verb{[environment]}\cr The environment to use for scoping.}
}
\value{
\code{[any]}\cr The results of the evaluation of the \code{code}
argument.
}
\description{
Temporarily change the system search path.
}
\examples{
# temporarily modify the system PATH, *replacing* the current path
with_path(getwd(), Sys.getenv("PATH"))
# temporarily modify the system PATH, *appending* to the current path
with_path(getwd(), Sys.getenv("PATH"), "suffix")
}
\seealso{
\code{\link{withr}} for examples

\code{\link[=Sys.setenv]{Sys.setenv()}}
}