I have a question about specifying external libraries using roxygen2. To import other packages I just have to add within function description @import <package_name>
. But is there any way how can we do it not at function level I mean not as function description? Bringing external packages at function level in my opinion can bring problems in future when modifying functions within package. For example if I do not want to have function in my package, it's very easy to delete it with imports within it.
To summarize
Is there any possibility how can I refer to external package but not at function level, but more at package level when building package?
You could create a dedicated myPackage.R
file with general package description as well as global imports, see Documenting Packages :
#' Package Title
#'
#' Description of my package
#'
#' Link to the functions of MyPackage :
#' * [function1()]
#' * [function2()]
#' * [...]
#'
#'
#' @author Me, Others
#' @docType package
#' @name myPackage
#' @import otherPackage
NULL
The NULL
at the end is needed, as this file doesn't refer to a specific object in the package.