gchart_set_cache {gchartsmap}R Documentation

Set up a cache directory

Description

Ensures that the directory exists and sets the environment variable for access.

Usage

gchart_set_cache(
  path = tools::R_user_dir(package = "gchartsmap", which = "cache"),
  install = FALSE,
  overwrite = FALSE,
  home = "HOME"
)

Arguments

path

Path to use for the package cache.

install

if TRUE, will install the cache path in your .Renviron file for use in future sessions. Defaults to FALSE.

overwrite

If this is set to TRUE, it will overwrite an existing cache path that you already have in your .Renviron file.

home

Path for the .Renviron file. Defaults to "HOME".

Value

Sets and returns the path to the cache where downloaded data will be stored. Is used for the side effect of setting the 'R_GOOGLE_CHART_CACHE' environment variable, and can store the path in '.Renviron' for use in future R sessions if requested.

Examples


library(package = "gchartsmap")

# set the cache path to a temp folder
gchartsmap::gchart_set_cache(path = tempdir())


# save the cache path in a temporary folder
# if you want to save the cache path in your default .Renviron,
# use the default for path
gchartsmap::gchart_set_cache(
  install = TRUE, path = tempdir(), overwrite = TRUE, home = tempdir()
)

# clean up
list.files(
  tempdir(), all.files = TRUE, full.names = TRUE, pattern = ".Renv"
) |>
 unlink()



[Package gchartsmap version 1.0.1 Index]