with_extr_sandbox {extractox} | R Documentation |
Run Code in a Temporary Sandbox Environment
Description
This function creates a temporary directory and sets it as R_USER_CACHE_DIR
before executing the provided code block. It is used for testing or running
code without affecting the user's default cache directory as required by CRAN for the examples .
This function is not designed to be used by package users. Shamelessly "inspired" by
some @luciorq code.
Usage
with_extr_sandbox(code, temp_dir = tempdir())
Arguments
code |
The code to be executed inside the sandbox. Should be an expression. |
temp_dir |
A temporary directory created using |
Value
The result of the executed code.
Examples
with_extr_sandbox(Sys.getenv("R_USER_CACHE_DIR"))
with_extr_sandbox(tools::R_user_dir("extractox", "cache"))
[Package extractox version 1.0.0 Index]