addMemoization: Creates a copy of an existing function such that its results...

addMemoizationR Documentation

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 documentation built on July 21, 2022, 5:11 p.m.