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

more robust digest when calculating cache id

parent 8d0d405a
No related branches found
Tags v1.8
No related merge requests found
......@@ -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)))
......
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