File: with_path.Rd

package info (click to toggle)
r-cran-withr 3.0.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 620 kB
  • sloc: sh: 13; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download | duplicates (2)
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
40
41
42
43
% 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 = c("prefix", "suffix", "replace"))

local_path(
  new = list(),
  action = c("prefix", "suffix", "replace"),
  .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"}
(the default) 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, *prefixing* 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()}}
}