The douple-colon variant ::
has a clear advantage in the rare situations, when the same function name is used by two packages. There is a function psych::alpha
to calculate Cronbach's alpha as a measure of internal consistency and a function scales::alpha
to modify color transparency. There are not that many examples but then again, there are examples. dplyr
even masks functions from the stats
and base
package! (And the tidyverse is continuing to produce more and more entries in our namespaces. Should you use dyplr
you do not know, if the base
function you use today will be masked by a future version of dplyr
thus leading to an unexpected runtime problem of your package in the future.)
All of that is no problem if you use the ::
variant. All of that is not a problem if in your package the last package opened is the one you mean.
The require
(or library
) variant leads to overall shorter code and it is obvious, at what time and place in the code the problem of a not-available package will lead to an error and thus become visible.
In general, both work well and you are free to choose, which of these admittedly small differences appears more important to you.