Commit 0f2d2006 authored by Holger Brandl's avatar Holger Brandl

more robust digest when calculating cache id

parent 8d0d405a
......@@ -170,7 +170,7 @@ 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, filePrefix="cache"){
cacheFile <- paste0(filePrefix, "_", substr(digest::digest(expr), 1,6)) %>% paste0(".", ., ".RData")
cacheFile <- paste0(filePrefix, "_", substr(digest::digest(deparse(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