Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

unload

Unload or reload a given module


Description

Unload a given module or reload it from its source.

Usage

unload(mod)

reload(mod)

Arguments

mod

the module reference to be unloaded or reloaded

Details

Unloading a module causes it to be purged from the internal cache such that the next subsequent box::use declaration will reload the module from its source. reload is a shortcut for unloading a module and calling box::use in the same scope with the same parameters as the box::use call that originally loaded the current module instance.

Value

box::unload and box::reload are called for their side-effect. They do not return anything.

Note

Any other references to the loaded modules remain unchanged, and will still work. Unloading and reloading modules is primarily useful for testing during development, and should not be used in production code.

unload and reload come with a few restrictions. unload attempts to detach names attached by the corresponding box::use call. reload attempts to re-attach these same names. This only works if the corresponding box::use declaration is located in the same scope.

reload will re-execute the .on_load hook of the module.

See Also


box

Write Reusable, Composable and Modular R Code

v1.0.2
MIT + file LICENSE
Authors
Konrad Rudolph [aut, cre] (<https://orcid.org/0000-0002-9866-7051>), Michael Schubert [ctb] (<https://orcid.org/0000-0002-6862-5221>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.