0

I want to write my own package and use "nodes" function from bnlearn and graph package. But when I check my package this warning appears:

Warning: replacing previous import 'bnlearn::nodes' by 'graph::nodes' when loading 'mypackage'

I used "::" everywhere for nodes function to determine the package. But the warning message didn't solve. In advance thanks for your help. thank you all for your answers. I added "library(..., warn.conflicts=FALSE)" to my vignette but unfortunately, when I submit my package to cran, they reject it just for this one warning.

  • 3
    The warning message will show up regardless of whether you use `::` scoping. If you always use `::`, then you should not be prone to the masking that this is warning about. Have you actually tried your functions (in the presence of these warnings) to determine which function is actually being called? (BTW: you can use `library(..., warn.conflicts=FALSE)` to avoid this warning, even though the function masking is still a factor.) – r2evans Jan 18 '20 at 04:26
  • Said differently, since *your* packages imports two packages that each have a `nodes` function, it doesn't matter which order you load them, this warning will be provided. – r2evans Jan 18 '20 at 04:26
  • See this question https://stackoverflow.com/q/51899220/547331 among others. – Martin Morgan Jan 18 '20 at 10:01
  • @Martin Morgan thanks for your considering but that was not my question. – Samaneh Maleknia Jan 18 '20 at 14:54
  • @r2evans thanks for your considering. I added "library(..., warn.conflicts=FALSE)" to my vignette but unfortunately, when I submit my package to cran, they reject it just for this one warning. – Samaneh Maleknia Jan 18 '20 at 14:55
  • @SamanehMaleknia are you sure? Maybe provide more information, like when the warning occurs (when checking vignettes? when loading the package?) and how you use Imports: versus Depends: in the DESCRIPTION file, as well as your NAMESPACE file. – Martin Morgan Jan 18 '20 at 14:57
  • I have: importFrom(bnlearn,nodes) importFrom(graph,nodes) in my NAMESPACE file. Also I have: Imports: bnlearn, graph, in my DESCRIPTION. How can I define more information when this warning occurs? @Martin Morgan – Samaneh Maleknia Jan 18 '20 at 15:05
  • Only import one, e.,g. `importFrom(bnlearn, nodes)`, and then use `graph::nodes()` in your code. Include both bnlearn and graph in the Imports: field of DESCRIPTION. – Martin Morgan Jan 18 '20 at 15:13
  • @Martin Morgan Thanks a lot, Thanks a lot, Thanks a lot Mr Morgan. My problem solved after four months. – Samaneh Maleknia Jan 18 '20 at 15:58

0 Answers0