Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addMemoization

Creates a copy of an existing function such that its results are memoized


Description

Creates a copy of an existing function such that its results are memoized.

Usage

## Default S3 method:
addMemoization(fcn, envir=parent.frame(), ...)

Arguments

fcn

A function (or the name of a function) that should be copied and have memoization added.

envir

The environment from where to look for the function.

...

Additional arguments for controlling the memoization, i.e. all arguments of memoizedCall() that are not passed to do.call().

Details

The new function is setup such that the the memoized call is done in the environment of the caller (the parent frame of the function).

If the function returns NULL, that particular function call is not memoized.

Value

Returns a function.

Author(s)

Henrik Bengtsson

See Also

The returned function utilized memoizedCall() internally.


R.cache

Fast and Light-Weight Caching (Memoization) of Objects and Results to Speed Up Computations

v0.15.0
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.