cache {Biobase}R Documentation

Evaluate an expression if its value is not already cached.

Description

Cache the evaluation of an expression in the file system.

Usage

    cache(name, expr)

Arguments

name A character of length 1.
expr An expression.

Details

This function can be useful during the development of computationally intensive workflows, for example in vignettes or scripts. The function uses a cache file in the current working directory whose name is obtained by paste("tmp-", name, ".RData", sep="").

When cache is called and the cache file exists, it is loaded and the object whose name is given by name is returned. expr is not evaluted.

When cache is called and the cache file does not exist, expr is evaluted, and its value is saved into the file under the name given by name and returned.

To delete all cache files, command like rm tmp-* should do.

Value

The (cached) value of expr.

Author(s)

Wolfgang Huber, huber@ebi.ac.uk

Examples

    myComplicatedObject <- cache("myComplicatedObject", { runif(10) })

[Package Biobase version 1.10.1 Index]