with_envvar | R Documentation |
Temporarily change system environment variables.
with_envvar(new, code, action = "replace")
local_envvar(
.new = list(),
...,
action = "replace",
.local_envir = parent.frame()
)
new , .new |
|
code |
|
action |
should new values |
... |
Named arguments with new environment variables. |
.local_envir |
|
if NA
is used those environment variables will be unset.
If there are any duplicated variable names only the last one is used.
[any]
The results of the evaluation of the code
argument.
withr
for examples
Sys.setenv()
with_envvar(new = c("GITHUB_PAT" = "abcdef"), Sys.getenv("GITHUB_PAT"))
# with_envvar unsets variables after usage
Sys.getenv("TEMP_SECRET")
with_envvar(new = c("TEMP_SECRET" = "secret"), Sys.getenv("TEMP_SECRET"))
Sys.getenv("TEMP_SECRET")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.