Commit 8d0d405a authored by Holger Brandl's avatar Holger Brandl

fixed cache_it to always include hash in file names

parent d80c7663
......@@ -169,8 +169,8 @@ replaceNA <- function(x, withValue) { x[is.na(x)] <- withValue; x }
## related: http://cran.r-project.org/web/packages/R.cache/R.cache.pdf
cache_it <- function(expr, cacheName=paste0("cache_", substr(digest::digest(expr), 1,6))){
cacheFile <- paste0(".", cacheName, ".RData")
cache_it <- function(expr, filePrefix="cache"){
cacheFile <- paste0(filePrefix, "_", substr(digest::digest(expr), 1,6)) %>% paste0(".", ., ".RData")
if(file.exists(cacheFile)){
local(get(load(cacheFile)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment