When I did a CRAN check I got an issue pop up:
Error: package or namespace load failed for ‘bestpackage’:
object 'head' not found whilst loading namespace 'bestpackage'
Execution halted
It looks like this package (or one of its dependent packages) has an
unstated dependence on a standard package. All dependencies must be
declared in DESCRIPTION.
See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
manual.
Fair enough, I already had utils
in my imports
in the DESCRIPTION
file, but popped in a nice @importFrom utils head
into the function docs I created that was using head
.
The next CRAN check now did not have that error, but now my tests are not passing that have head
in them. The error being:
Error in UseMethod("head") :
no applicable method for 'head' applied to an object of class "data.frame"
Any idea why adding in the @importFrom
would be causing that?
EDIT:
I think this is is because my test was running head in another packages' namespace (SparkR) that does not have utils in its imports
or depends
. SparkR will automatically scour the function being run and pull in from your search path any namespaces that are missing in the function you submitted. So my question really is:
When I use @importFrom utils head
, it creates an entry in my Namespace. What does this actually do with regard to the search path for the S3 generic? It seems like SparkR accessed the right S3 method before, but after I add the @importFrom
it is not loading the needed S3 method.
Dan