preknit_cache: Cache or Load an Object Depending on Interactive Status

View source: R/rmd_cache.R

preknit_cacheR Documentation

Cache or Load an Object Depending on Interactive Status

Description

If called in an interactive session, the object will be cached to be subsequently loaded in a non-interactive session, such as when R markdown is knit. A previous run of a given chunk is required and an error will be thrown if the cached object does not exist.

Usage

preknit_cache(object, dirs)

Arguments

object

Object to be cached.

dirs

Required. Path to the subdirectory within R.cache root path to save the cache to.

Details

This function is useful when reporting on a process that has already been executed and does not require re-execution during the knitting process. For example, a Neo4j database can be written in an interactive session at which point the metadata for reporting purposes can be logged. Instead of forcing the database to be instantiated when the R markdown is knit, knitr will only pull up the cached log.

Value

  If called in a non-interactive session, the object will be returned

in the parent frame without being declared.

See Also

saveCache,findCache,loadCache


meerapatelmd/easyBakeOven documentation built on March 30, 2022, 1:42 p.m.