cache_method | R Documentation |
Take a function and return a cached version. The arguments and results of a cached method is saved to disk and if the cached function is called again with the same arguments then the results will be retrieved from the cache rather than be recomputed.
cache_method(f, cache = getOption("CellBench.cache"))
f |
the function to be cached |
cache |
the cache information (from memoise package) |
(CAUTION) Because cached functions called with the same argument will always return the same output, pseudo-random methods will not return varying results over repeated runs as one might expect.
This function is a thin wrapper around memoise
function whose results are cached and is called identically to f
set_cellbench_cache_path
# sets cache path to a temporary directory
set_cellbench_cache_path(file.path(tempdir(), ".CellBenchCache"))
f <- function(x) { x + 1 }
cached_f <- cache_method(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.