Skip to content
Snippets Groups Projects
Commit 8d0d405a authored by Holger Brandl's avatar Holger Brandl
Browse files

fixed cache_it to always include hash in file names

parent d80c7663
No related branches found
Tags v1.8
No related merge requests found
......@@ -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)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment