Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Does a lazy load across all files when provided a knitr cache directory.
#' Performs lazy load on a directory
#' @param path a filepath containing the necessary files for lazy loading
#' @return NULL
#' @details This function will go into a directory, search for all the files
#' that seem like they can be lazily loaded and attempt to load them.
lazierLoad <- function(path){
files <- dir(path)
cache_files <- sub(".rdb$", "", files[grepl(".rdb$", files)])
for (i in cache_files) try(lazyLoad(paste(path, i, sep = "/"), envir = .GlobalEnv))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment