Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the Autoloads environment do?

Tags:

r

The second-to-last item on the search() path is (always?) an environment called Autoloads. All I could find about this topic is a sentence on page 26 of the R language definition (pdf).

An Autoloads environment is used for holding proxy objects that may be loaded on demand.

Please can you give me more of an explanation about what this is environment is used for.

like image 801
Richie Cotton Avatar asked Nov 15 '12 16:11

Richie Cotton


1 Answers

Autoloading provides a way of loading packages in the future, only at the point at which they are used (if at all). So if a function from a package may soon be used, but (for memory reasons, perhaps) you don't want to load the package unless absolutely necessary, you can use the autoload function to promise to make a function available if it is used.

The Autoloads environment (accessible via as.environment("Autoloads") or .AutoloadEnv) stores the functions that it will promise to load and a character vector, .Autoloaded, that names the packages that need to be loaded.

Further information can be found in the ?autoload help page and R-FAQ 7.6.

like image 184
3 revs Avatar answered Sep 18 '22 20:09

3 revs