set_renv_shared_cache: Set .Renviron to point to global RENV cache

View source: R/utils.R

set_renv_shared_cacheR Documentation

Set .Renviron to point to global RENV cache

Description

Helper function to create or append the global library cache location for renv. Several checks will be performed, which, if prompt is set to TRUE will determine the behavior. First, a search will be performed for an existing .Renviron file. Second, if the environment variable named 'RENV_PATHS_CACHE' is set, it will ask if any existing key-value pair by this name in an .Renviron file should be removed prior to writing a new entry. This function can only be used in interactive mode.

Usage

set_renv_shared_cache(
  cache_loc,
  work_loc = getwd(),
  env_var = "RENV_PATHS_CACHE",
  prompt = TRUE
)

Arguments

cache_loc

Location of a (ideally global) cache location for renv.

work_loc

Working environment in which to search, create/append the contents (default: getwd()).

env_var

The key name in the .Renviron file, as determined in renv, (default RENV_PATHS_CACHE).

prompt

Boolean, to determine if process checking occurs or to accept overwriting defaults.

Examples

loc <- 'loc/to/my/global/cache' # Should be known in advance for the team sharing the cache...
set_renv_shared_cache(cache_loc = loc)
set_renv_shared_cache(loc, prompt = FALSE)

al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.