I often use utility type functions from other packages that are un-exported:
pkg:::fun()
. I am wondering if I can use such a function within new functionality/s
Summarising comments from @baptise, and etc...:
:::
not allowed on CRAN, so options:
Another trick is using getFromNamespace():
fun <- utils::getFromNamespace("fun", "pkg")
The only advantage over :::
is that you don't get any NOTEs and it's allowed on CRAN. Of course, this is not good practice as a hidden change in pkg
can break your package.
Note: With roxygen2 you have to add the utils
package to the Imports
field of your DESCRIPTION
file to fulfill CRAN's requirements. Alternatively, you can put it in your NAMESPACE
manually.