Software
memoise
Easy memoisation for R
R
The memoise package implements memoization for R functions, which caches function results so that repeated calls with the same inputs return previously computed outputs without re-executing the function. This speeds up expensive computations when functions are called multiple times with identical arguments.
The package uses the cachem library for caching, which provides automatic pruning to prevent caches from growing indefinitely. You can cache in memory or on disk, customize cache size and expiration times, and share caches between multiple functions. The cache key includes both function arguments and the function body itself, preventing collisions when different memoised functions are called with the same arguments.
memoise
memoise
memoise



