xache: xache

Description Usage Arguments Details Examples

Description

'xache' works as follows:

Usage

1
2
xache(symbol, file, init, ..., verbose = FALSE, force = FALSE,
  envir = parent.frame())

Arguments

symbol

A string representing the variable that holds the results.

file

A path towards a RData file from which to load and to which to #' save the contents of the above variable.

init

A function that will generate the contents if it does not already exist.

...

Arguments to pass to the init function.

verbose

Whether to print debug messages to screen. Defaults to FALSE.

force

Whether to force recomputation. Defaults to FALSE.

envir

The environment in which to look for, and if it does not already exist, to create the variable of interest.

Details

1. If the specified variable exists, nothing happens because there is no need to recompute its contents. 2. If it the variable does not exist, 'xache' will attempt to load it from the specified RData file. 3. If the RData file does not exist, the specified function will evaluate the specified function, and store its results in the specified variable as well as in the RData file.

Examples

1
2
3
4
xache("test", "test.RData", function () {
 # do some calculation
 2 * 2 # dummy result
})

ndejay/xache documentation built on May 14, 2019, 5:02 a.m.