Hello RStudio Community!
My colleagues and I have started to build-out multiple R packages for our company. We have built all of our packages thus far using the :: operator to access functions from external packages we use. We are starting to explore the golem package to turn our shiny apps into R packages. Generally, when we make shiny apps we follow the tradition of putting
library(...) on top. Since we are in package land now, we have been discussing what route makes sense for long term development. Should we switch to using @import/@importFrom within roxygen, or do we have our developers continue using ::? @import does make the script cleaner, however it can be hard to track which function comes from where.
Karl Broman wrote a minimal tutorial about R packages where he mentions (under the
NAMESPACE file header): "And probably it’s best to skip the whole
@importFrom technique and just use the
:: operator, particularly for clarity:
jsonlite::unbox( ) makes it clear that
unbox is not part of the present package but is part of jsonlite." This currently makes sense to us and that is why we use the :: while developing in packages.
We are a smaller group of developers and are wanting to bring in others into this discussion. What do you do for production-ready packages? Is there a standard we are unaware of? Please share any stories and/or reasons why you chose one over the other.