[R-pkg-devel] Calls not declared

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Mar 11 16:32:52 CET 2019


I did not see any mention of the distinction between Depends and Imports in the DESCRIPTION file... which is always a risk when duplicating existing documentation in an email. Imports is preferred because the user does not have to put definitions only needed inside your package into their public search path (easier to make under-the-hood changes to the package implementation), but Depends is better when they cannot make use of your package without those definitions (e.g. you return a ggplot object from one of your functions).

So do keep reading the documentation... email is just a kickstart.

On March 11, 2019 8:19:33 AM PDT, Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>On 11/03/2019 9:53 a.m., Elias Carvalho wrote:
>> I am developing my first package and found these errors when checking
>it.
>> 
>> Any help?
>> 
>> 
>> * checking dependencies in R code ... WARNING
>> 'library' or 'require' calls not declared from:
>>    ‘qgraph’ ‘semPlot’ ‘sna’ ‘xlsx’
>
>Without seeing your package I might be wrong, but I believe this says 
>that you have something like
>
>library(qgraph)
>
>somewhere in your R code, without listing
>
>Depends: qgraph
>
>in your DESCRIPTION file.
>
>HOWEVER, fixing this warning will lead to a different one, because 
>that's not the recommended way to do things now.  There are two 
>possibilities:
>
>1.  Your package is useless without the dependency.
>
>In this case, you should put
>
>Imports:  qgraph, ...
>
>in the DESCRIPTION file (where ... lists the other packages with the 
>same status), and list the functions in those packages in your
>NAMESPACE 
>file, using
>
>importFrom(qgraph, ...)
>
>etc.  (If you use Roxygen, you use comments in the source to get it to 
>put this into your NAMESPACE file.)
>
>2.  Your package works without the dependency, but you may want to
>issue 
>errors or warnings if it is missing.
>
>Then you should put
>
>Suggests:  qgraph, ...
>
>in the DESCRIPTION file, and to use a function from it, use something
>like
>
>if (requireNamespace("qgraph")) {
>   qgraph::foo(...)
>} else
>   warning("qgraph is not available.")
>
>Duncan Murdoch
>
>______________________________________________
>R-package-devel using r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-package-devel mailing list