Quantcast
Viewing all articles
Browse latest Browse all 205423

When does a package need to use ::: for its own objects

Consider this R package with two functions, one exported and the other internal

hello.R

#' @export
hello <- function() {
  internalFunctions:::hello_internal()
}

hello_internal.R

hello_internal <- function(x){
    print("hello world")
}

NAMESPACE

# Generated by roxygen2 (4.1.1): do not edit by hand

export(hello)

When this is checked (devtools::check()) it returns the NOTE

There are ::: calls to the package's namespace in its code. A package
  almost never needs to use ::: for its own objects:
  ‘hello_internal’

Question

Given the NOTE says almost never, under what circumstances will a package need to use ::: for its own objects?


Extra

I have a very similar related question where I do require the ::: for an internal function, but I don't know why it's required. Hopefully having an answer to this one will solve that one. I have a suspicion that unlocking the environment is doing something I'm not expecting, and thus having to use ::: on an internal function.

If they are considered duplicates of each other I'll delete the other one.


Viewing all articles
Browse latest Browse all 205423

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>