[R] Risks of using "function <- package::function" ?
boris.steipe at utoronto.ca
Thu Nov 16 22:53:04 CET 2017
Large packages sometimes mask each other's functions and that creates a headache, especially for teaching code, since function signatures may depend on which order packages were loaded in. One of my students proposed using the idiom
<function> <- <package>::<function>
... in a preamble, when we use just a small subset of functions from a larger package. I like that idea and can't see obvious disadvantages(1).
Are there subtle risks to that approach?
(1) I think there could be an issue when packages that are loaded later depend on and extend a function that has has been made local. But I'm not even sure what happens then, and it may be more of a hypothetical anyway - can't even think of a situation with which to test it off the top of my head.
More information about the R-help