user_dir: user_dir

View source: R/os.R

user_dirR Documentation

user_dir

Description

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()

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.

Value

a directory (created if not exists)

Author(s)

Guangchuang Yu

See Also

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


yulab.utils documentation built on Nov. 26, 2026, 9:08 a.m.