R CMD check fails due to error

R CMD check is failing due to this error:
'::' or ':::' imports not declared from <this package>

I'm assuming this has something to do with the DESCRIPTION file, in which I import and require various packages. However, I am importing a package from a non-CRAN repository, which I file under Remotes:. Does this error have anything to do with the fact that a line of code I have, learnr::get_all_state_objects() requires the dev version of learnr and not the CRAN version?

1 Like

The problem is that get_all_state_objects() is not exported from {learnr}. It's nothing to do with the development vs release versions of {learnr}. As far as I can tell, that function is in both versions, but it's an internal function.

In your code, you've probably used it in the context of learnr:::get_all_state_objects() with three : symbols. This means that the function is in the package {learnr}, but isn't exported, so you're not really supposed to use it. It's only to be used inside the package (i.e. by other functions in that package).

There are a few ways to solve this:

  • Copy-and-Paste the function to your package. Don't do this. It's not cool. It's essentially stealing and you'll probably get caught out. (There are also licensing issues and I know nothing about Apache Licenses, which the package comes under).
  • Figure out why you need this function and write your own function that does a similar thing. I doubt you need the actual output from this function as internal functions are usually only supposed to work on highly specified objects. But you can look at what exported functions call this one and try to figure out why you think you need it.
  • Finally, ask permission from the package authors to use this function in your package.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.