lazyData (version 1.1.0)

lazyData-package: A LazyData Facility

Description

Supplies a LazyData facility for packages which have data sets but do not provide LazyData. A single function is is included, requireData, which is a drop-in replacement for base::require, but carrying the additional functionality.

Arguments

Details

Package:
lazyData
Type:
Package
Version:
1.1.0
Date:
2016-12-05
License:
GPL-2
If a package is attached with requireData, a check is made to see if a) the package provides data and b) if the data sets are not made visible to the user via LazyData: true. If both are the case, the package is attached to the search path, and in addition a second entry to the search path is made immediately behind the package containing promises to load the data sets should they be needed. This keeps data sets out of the global environment (unless they are modified), making them visible without occupying memory (unless they are needed).

Using requireData a second time on the same package has the effect of flushing any data sets brought into memory and reinstating them as promises.

References

None.

See Also

require, library, data delayedAssign

Examples

Run this code

requireData("mgcv") ## we assume has data sets but no LazyLoad
.Search()           ## show the augmented search path

## > ls("datasets:mgcv")
##[1] "columb"       "columb.polys"

Run the code above in your browser using DataLab