caching: Caching Utility Functions

cachingR Documentation

Caching Utility Functions

Description

Quick caching utility read/write functions utilizing the qs package.

Usage

write_cache(x, name = NULL, cache_dir = "cache", overwrite = TRUE)

read_cache(x, name = NULL, cache_dir = "cache")

Arguments

x

object to cache

name

name of object to read in.

cache_dir

path to cache directory.

overwrite

logical (default = TRUE)

Value

invisibly returns object passed to the function.

x

invisibly attaches object to parent global environment

See Also

qs::qread() and qs::qsave()

Examples

## Not run: 
mydata <- mtcars
write_cache(mydata) # will save to 'cache/mydata'.
write_cache(mydata, "mydata-v2", cache_dir = "data/temp") # will save to 'data/temp/mydata-v2'

# read back in
read_cache(mydata)

## End(Not run)

jimbrig/jimstools documentation built on Sept. 12, 2022, 12:08 p.m.