Preload a package into memory without attaching it

Which would be a good way to preload a bunch of commonly used R packages into memory when I start the R process, but don't really attach them. Preferably so that there are no side effects.

If I do something like:

getNamespace("XML"); 

The package is loaded and displayed in sessionInfo() :

 loaded via a namespace (and not attached): [1] XML_3.6-2 

Does it have any side effects? I specifically want to prevent any form of disguise if I do this for a large number of packets. The sole purpose of this is to speed up the process when the library() function is called or mypackage::somefunction .

+4
source share
1 answer

It does not have a direct side effect in the search path or the global environment (which, I think, is bothering you). However, it will load dependent packages and run .onLoad , which theoretically can have side effects (this should not be, but theoretically, developers of a bad package can interact with your environment).

+3
source

Source: https://habr.com/ru/post/1390368/


All Articles