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.