cache.init {easyr}R Documentation

Initialize cache.

Description

Set cache info so easyr can manage the cache.

Usage

cache.init(
  caches,
  at.path,
  verbose = TRUE,
  save.only = FALSE,
  skip.missing = TRUE,
  n_processes = 2
)

Arguments

caches

List of lists with properties name, depends.on. See example.

at.path

Where to save the cache. If NULL, a cache/ folder will be created in the current working directory.

verbose

Print via cat() information about cache operations.

save.only

Choose not to load the cache. Use this if you need to check cache validity in multiple spots but only want to load at the last check.

skip.missing

Passed to hashfiles, choose if an error occurs if a depends.on file isn't found.

n_processes

Passed to qs to determine how many cores/workers to use when reading/saving data.

Examples

# initialize a cache with 1 cache which depends on files in the current working directory.
# this will create a cache folder in your current working directory.
# then, you call functions to check and build the cache.
## Not run: 

  folder = system.file('extdata', package = 'easyr')
  cache.init(

   # Initial file read (raw except for renaming).
   caches = list(
     list( 
      name = 'prep-files',
      depends.on = paste0(folder, '/script.R')
     )
   ),

   at.path = paste0(tempdir(), '/cache')

  )


## End(Not run)

[Package easyr version 0.5-11 Index]