Skip to contents

get the user dir to save app caches, logs and data (a wrapper function of tools::R_user_dir())

Usage

user_dir(
  appname = NULL,
  which = c("data", "config", "cache"),
  appauthor = NULL,
  ...
)

Arguments

appname

App name (a single directory name)

which

one of "data", "config" or "cache", see tools::R_user_dir()

appauthor

ignored, kept for backward compatibility

...

passed on to tools::R_user_dir()

Value

a directory (created if not exists)

Details

tools::R_user_dir() is used instead of rappdirs::user_data_dir() because it honors the R_USER_<which>_DIR environment variables, with which R CMD check (and CRAN) redirects all user-level directories to a temporary location. A directory written outside of tempdir() during checks violates the CRAN policy.

See also

Other os-utils: exec(), has_internet()

Author

Guangchuang Yu