10.3 Search path
More motivation for namespace
10.3.1 Function lookup for user code
Where does R look for an object?
- The global environment.
- The packages that have been attached in reverse order.
Autoloads
.- The base environment.
Adding another package changes the search path, but fortunately this is not applicable to package code.
10.3.2 Function lookup inside a package
Advanced section developed from Advanced R chapter on environments.
Two environments:
- Package environment: external interface with parent determined by search path and exposes exported objects.
- Namespace environment: internal interface including all objects in package.
Every namespace environment has the same ancestors:
- imports environment: controlled by
NAMESPACE
file - base namespace: base environment bindings
- global environment