Last active
September 11, 2015 16:22
-
-
Save zkamvar/655be26d1d5bec1ac948 to your computer and use it in GitHub Desktop.
Does a lazy load across all files when provided a knitr cache directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' 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