[R] lazy loading like object
Matteo Mattiuzzi
matteo.mattiuzzi at boku.ac.at
Tue May 28 09:20:31 CEST 2013
Dear List,
I'm writing the package MODIS (currently on R-forge), I lazy load some data which is a very elegant solution. These lazy loaded objects are typically used inside functions, most of that objects are not directly used by users. One of the objects I want to lazy load (is a result of a function) has the problem that it can only be generated having an external library (gdal-bin) installed. This installation enables _some_ (important) functionality in the package.
The problem is that to generate this object it takes some time (on Linux less than 2 sec on windows 5 and more). I can not provide this object within the package source code (ie as RData) as I'm not sure if it is the same on every Hardware/Software environment.
I think there are several imaginable solutions (that I can't solve by my own).
One is to hide it for the R CMD check and INSTALL process? (This would be a solution as the object is only needed inside functions already enabled by gdal-bin)
To generate the object and send it to the package environment...(I don't know how)
Basically I'm aiming at a object loaded _once_after_the_check_of_the_availability_ of the external library gdal-bin. So it takes only _once_ the time to produce that object that is from now on available for any other function in the package environment.
I hope I was clear, thanks in advanced,
Matteo Mattiuzzi
More information about the R-help
mailing list