Reload 'Rmarkdown' cache in the order files were created, into an R environment
Arguments
- dir
character
path to the directory that contains 'Rmarkdown' cache files. Each file is recognized by the file extension".rdx"
.- maxnum
integer
indicating the maximum number of cache files to re-load, in order.- max_cache_name
character
optional string indicating the name of an 'Rmarkdown' cache chunk where this function will stop loading cache data. All cache files after this point will not be loaded. This option is intended to help recreate the data available to a particular 'Rmarkdown' chunk during processing.- envir
environment
in which data is populated, defaultnew.env()
creates a newenvironment
which is returned invisibly.- file_sort
character
string indicating how to sort cache files, default uses best available, in order: "globals" (global index file), "objects" (object index file), "ctime" (creation time), "mtime" (modification time). The global index is preferred, and other options are intended for rare scenarios when the global index is not available. The methods using"mtime"
or"ctime"
is less accurate, yet may be sufficient for simple output."globals"
uses the"__globals"
file in the cache directory."objects"
uses the"__objects"
file in the cache directory.ctime
sorts by file creation timemtime
sorts by file modification time
- preferred_load_types
character
string indicating the preferred load mechanism, default uses"lazyLoad"
if '.rdx'/'.rdb' files are available, otherwise"load"
to load '.RData'/'.rda' files. The 'lazyLoad' '.rdx'/.'rdb' files are created when 'Rmarkdown' options includecache=TRUE, cache.lazy=TRUE
. The load option is used whencache=TRUE, cache.lazy=FALSE
which is preferred for some analyses involving large data objects.- dryrun
logical
default FALSE, whether to perform a dry-run, which prints messages and does not load the data.- verbose
logical
default TRUE, whether to print verbose output. This argument is not passed to other functions.- ...
additional arguments are passed to
lazyLoad()
orload()
as relevant to the method used to re-load the cache object data.
Details
This function is intended to help re-load 'Rmarkdown' cache files created during the processing/rendering of an 'Rmarkdown' file.
By default, all cached R objects are loaded into the
environment defined by envir
, However,
it is recommended that envir
is used to define a new environment
into which the cached session is loaded.
From then on, the cached data objects can be seen with ls(cache_env)
and retrieved with get("objectname", envir=cache_env)
.
If supplied with maxnum
or max_cache_name
then the cache
will be loaded only up to this point, and not beyond.
The recommended method to determine the cache is to use dryrun=TRUE
to view all sections, then to choose the integer
number, or
character
name to define the maximum chunk to load.
See also
Other jam practical functions:
breakDensity()
,
call_fn_ellipsis()
,
checkLightMode()
,
check_pkg_installed()
,
colNum2excelName()
,
color_dither()
,
exp2signed()
,
getAxisLabel()
,
isFALSEV()
,
isTRUEV()
,
jargs()
,
kable_coloring()
,
lldf()
,
log2signed()
,
middle()
,
minorLogTicks()
,
newestFile()
,
printDebug()
,
renameColumn()
,
rmInfinite()
,
rmNA()
,
rmNAs()
,
rmNULL()
,
setPrompt()