cacheit: Function to cache long operations

View source: R/cacheit.R

cacheitR Documentation

Function to cache long operations

Description

Save results from code that takes a long time to execute to a .rds file if that file does not exist in the cache directory. If the file exists in the cache directory, that file will be loaded to memory without evaluating the code.

Usage

cacheit(name, code, dir, createdir = FALSE, clearcache = FALSE)

Arguments

name

Name of the file to create without extension

code

Expression of the code to execute and cache

dir

Name of cache directory which should be placed in the working directory

createdir

Logical about whether to create the directory if it does not exist

clearcache

Logical about whether to recalculate the cached .rds file for this object

Details

For more information, please refer to the vignette using browseVignettes("nncc").

Value

Output of code, either freshly executed if the file does not exist or or clearcache is TRUE otherwise returns result from the cache file


nncc documentation built on May 29, 2024, 5:05 a.m.