File: using_something.Rd

package info (click to toggle)
r-cran-pkgmaker 0.32.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,192 kB
  • sloc: sh: 13; makefile: 2
file content (94 lines) | stat: -rw-r--r-- 2,265 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/with.r
\name{using_something}
\alias{using_something}
\alias{using_envvar}
\alias{using_env}
\alias{using_locale}
\alias{using_collate}
\alias{using_dir}
\alias{using_libpaths}
\alias{using_lib}
\alias{using_options}
\alias{using_par}
\alias{using_path}
\title{Execute code in temporarily altered environment.}
\usage{
using_envvar(new, code, action = "replace")

using_env(new, code)

using_locale(new, code)

using_collate(new, code)

using_dir(new, code)

using_libpaths(new, code)

using_lib(new, code)

using_options(new, code)

using_par(new, code)

using_path(new, code, add = TRUE, prepend = FALSE)
}
\arguments{
\item{new}{values for setting}

\item{code}{code to execute in that environment}

\item{action}{(for \code{using_envvar} only): should new values
\code{"replace"}, \code{"suffix"}, \code{"prefix"} existing environmental
variables with the same name.}

\item{add}{Combine with existing values? Currently for
\code{\link{using_path}} only. If \code{FALSE} all existing
paths are overwritten, which you don't usually want.}

\item{prepend}{logical that indicates if the new paths should
be added in front of the current ones.}
}
\value{
Nothing, used for side effect.
}
\description{
These functions were extracted from the \pkg{devtools} package
to make them available without a dependency to \pkg{devtools}.
}
\details{
\itemize{
\item \code{using_dir}: working directory
\item \code{using_collate}: collation order
\item \code{using_envvar}: environmental variables
\item \code{using_libpaths}: library paths, replacing current libpaths
\item \code{using_lib}: library paths, prepending to current libpaths
\item \code{using_locale}: any locale setting
\item \code{using_options}: options
\item \code{using_path}: PATH environment variable
\item \code{using_par}: graphics parameters
}
}
\section{Deprecation}{

\code{using_env} will be deprecated in devtools 1.2 and removed in
devtools 1.3
}

\examples{
getwd()
using_dir(tempdir(), getwd())
getwd()

Sys.getenv("HADLEY")
using_envvar(c("HADLEY" = 2), Sys.getenv("HADLEY"))
Sys.getenv("HADLEY")

using_envvar(c("A" = 1),
  using_envvar(c("A" = 2), action = "suffix", Sys.getenv("A"))
)
}
\author{
Hadley Wickham
}