Reputation: 974
I am building a package for the first time.
The package needs couple of libraries to work. Should I include those libraries in the package for every function? or should I include them in my main Script?
Upvotes: 1
Views: 357
Reputation: 60924
In the DESCRIPTION file in your package you can list the packages your package depends on. This will allow you to use the code from those packages to be used anywhere in your package. So, there is no need for explicit use of library
or require
. When your package is loaded, the other packages will also be loaded. In addition, when setting dependencies = TRUE
in install.packages
the packages your package depends on will also be installed (if available on CRAN).
Upvotes: 4