Learn R Programming

depcache (version 0.1-2)

depcache-package: depcache

Description

depcache

Arguments

Details

The functions in this package take an expression, walk its code to find its dependencies and calculate a hash of them. If a corresponding file already exists, it is loaded; otherwise, the expression is evaluated and its value is saved in the file. Optionally, this check may be performed every time a variable is accessed.

By default, a subdirectory of the current directory is used to store the cache files.

depcache

References

FNV-1a hash: http://www.isthe.com/chongo/tech/comp/fnv/

See Also

cache, %<-%

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
  a <- 1
  # will evaluate expression
  cache({ message('evaluating expression'); a + 1 }) # 2
  # will reuse cached value
  x %<-% { message('evaluating expression'); a + 1 } # 2
  x
  a <- 2
  # will recalculate the value
  x # 3
  
# }

Run the code above in your browser using DataLab