View source: R/with_sandbox_dir.R
with_sandbox_dir | R Documentation |
Runs user-defined code inside a temporary directory, setting up a temporary
working environment. This function is intended for use in examples and tests
and ensures that no data is written to the user's file space.
Environment variables such as HOME
, APPDATA
, R_USER_DATA_DIR
,
XDG_DATA_HOME
, LOCALAPPDATA
, and USERPROFILE
are redirected to
temporary directories.
with_sandbox_dir(code, .local_envir = base::parent.frame())
code |
expression An expression containing the user-defined code to be executed in the temporary environment. |
.local_envir |
environment The environment to use for scoping. |
This function is not designed for direct use by package users. It is primarily used to create an isolated environment during examples and tests. The temporary directories are created automatically and cleaned up after execution.
Returns NULL
invisibly.
condathis::with_sandbox_dir(print(fs::path_home()))
condathis::with_sandbox_dir(print(tools::R_user_dir("condathis")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.