Closed k-doering-NOAA closed 2 years ago
If we follow the proposed solution and then change our mind, it's really easy to switch from ::
to @import
or @importFrom
. Going from @import
to ::
requires more work to figure out which functions from which packages have been used.
Sorry for the slow response, Kathryn. I prefer a hybrid approach, where routinely used packages (e.g. ggplot2) are imported at the top of the function but less commonly used packages are called out with ::. Additionally, packages like dplyr with function names that are duplicated in other packages should probably (unfortunately) use ::
Thanks Jane, @Andrea-Havron-NOAA found this out after opening the issue (this is in the edited original issue, but reposting here for clarity):
Edited: Following recommendations for using ggplot2 in Rpackages, ggplot2:: should be used for all functions opposed to @import ggplot2
Now this popped back up again I would side with the :: approach. I think it is helpful to know explicitly where a function is coming from for debugging, review, and any future changes.
I also vote for using ::
Resolution: using :: except with the exceptions noted above in the Google style guide - all @import tags when needed are in fims-package.R file
Note: please thumbs up or thumbs down this comment if you agree/disagree with the style outlined here. Please also feel free to post what parts you like/dislike.
This Pull request brought up some questions about the style of importing packages (or functions within packages) for use within the FIMS R package. The options are:
::
within the FIMS function where it is needed, e.g.,mypkg::myfunction()
@import mypkg
or@importFrom mypkg myfunction
so that roxygen will automatically add either the whole package or the function to the NAMESPACE file.Solution: we could Follow the google style guide generally [our exceptions noted in brackets]
Another point is that ggplot2 code can look a bit messy, so we could useEdited: Following recommendations for using ggplot2 in Rpackages, ggplot2:: should be used for all functions opposed to@import ggplot2
. It also is already clear from the unique syntax what the package is.@import ggplot2