[Bioc-devel] R CMD check problems

Luca De Sano l.desano at campus.unimib.it
Thu Feb 25 17:48:49 CET 2016


I think that the answer of Marco Scutari, the maintainer of bnlearn, is the
best solution.
Using bnlearn 4.0-20160212 everything works in the right way:

Status: 0 ERROR, 0 WARNINGs, 0 NOTE

Thank you


Marco Scutari says:











*Hi Morgan, Hi Luca,  this problem is known to me and I have fixed it in my
developmentsnapshots at www.bnlearn.com <http://www.bnlearn.com/>. I have
basically given up on trying tobe elegant and I try-catch all the calls to
setMethods() and createthe generics as needed. The fix will eventually make
its way to CRAN,I expect sometime in late spring or early summer.Cheers,
Marco*


Martin Morgan says:

































*This reproduces the problem> loadNamespace('graph')<environment:
namespace:graph>> loadNamespace('bnlearn')Error: .onLoad failed in
loadNamespace() for 'bnlearn', details:  call: setMethod("nodes", cl,
function(object) .nodes(object))  error: no existing definition for
function 'nodes'and it's because of the way bnlearn loads itself  if
("graph" %!in% loadedNamespaces()) {    setGeneric("nodes",
function(object, ...) standardGeneric("nodes"))    setGeneric("nodes<-",
function(object, value) standardGeneric("nodes<-"))    setGeneric("degree",
function(object, Nodes, ...) standardGeneric("degree"))  }#THEN  # add the
methods.  for (cl in bnlearn.classes) {    setMethod("nodes", cl,
function(object) .nodes(object))    setMethod("nodes<-", cl,
function(object, value) .relabel(object, value))    setMethod("degree", cl,
function(object, Nodes) .degree(object, Nodes))  }#FORgraph is loaded but
not attached, so the generic that it defines is not visible to bnlearn.I'm
ccing the bnlearn maintainer*


--
Luca De Sano
tel: +393337177338
email: l.desano at campus.unimib.it
PEC: luca.desano at pec.it

On 25 February 2016 at 17:36, Joris Meys <Joris.Meys at ugent.be> wrote:

> Also not an expert, but I've looked at the dependencies and realized the
> following:
>
> The problem is likely due to import of Rgraphviz before bnlearn. Rgraphviz
> is dependent on graph, and graph also has a nodes generic. When bnlearn
> gets loaded, the nodes generic from the graph package is not visible for
> some reason (I hope some R guru can explain this a bit more correctly)
>
> So you have to make sure anything from bnlearn is imported before
> Rgraphviz. If you use Roxygen, you'll only get that working by importing
> bnlearn and not just those two functions.
>
> You also should split the file tronco.R in different files, one function
> each. Say you have the file tronco.capri.R and tronco.plot.R
>
> Then you can add to the file tronco.plot.R a tag
> @include tronco.capri.R
>
> to make sure that file is processed before tronco.plot.
>
> Last option is changing the namespace file manually, and then configure
> Roxygen2 to leave your namespace file alone. You can do that in RStudio by
> clicking on Project Options > build Tools and then the big "Configure"
> button next to "generate documentation with Roxygen".
>
> Or, on the command line:
> roxygen2::roxygenize(roclets = "rd")
>
> This leaves your namespace file alone.
>
> On a sidenote: if you import from the bnlearn package in the NAMESPACE
> file, you should add it to the field Imports and not Depends in the
> DESCRIPTION file. If you add it to the Depends field, the complete package
> is attached before your package is loaded. If you add it to the fields
> Imports on the other hand, its namespace is imported but not attached.
>
> See also Writing R Extensions:
>
> https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-Dependencies
>
>
> Cheers
> Joris
>
> On Thu, Feb 25, 2016 at 4:56 PM, Luca De Sano <l.desano at campus.unimib.it>
> wrote:
>
>> The problem is that the NAMESPACE is regenerated every time I execute the
>> document() command.
>>
>> At the moment, in the description file I've added bnlean
>>
>> Depends:
>>     R (>= 3.1),
>>     bnlearn,
>>     doParallel,
>>
>> to prevent this:
>>
>> > library(devtools)
>> > document()
>> Updating TRONCO documentation
>> Loading TRONCO
>> Loading required package: doParallel
>> Loading required package: foreach
>> foreach: simple, scalable parallel programming from Revolution Analytics
>> Use Revolution R for scalability, fault tolerance and more.
>> http://www.revolutionanalytics.com
>> Loading required package: iterators
>> Loading required package: parallel
>> Warning messages:
>> 1: .onLoad failed in loadNamespace() for 'bnlearn', details:
>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>>   error: no existing definition for function ‘nodes’
>> 2: .onLoad failed in loadNamespace() for 'bnlearn', details:
>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>>   error: no existing definition for function ‘nodes’
>> 3: .onLoad failed in loadNamespace() for 'bnlearn', details:
>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>>   error: no existing definition for function ‘nodes’
>> 4: .onLoad failed in loadNamespace() for 'bnlearn', details:
>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>>   error: no existing definition for function ‘nodes’
>>
>> With this configuration I can build and check the package, but the
>> warnings
>> mentioned above still remain.
>>
>>
>>
>>
>> --
>> Luca De Sano
>> tel: +393337177338
>> email: l.desano at campus.unimib.it
>> PEC: luca.desano at pec.it
>>
>> On 25 February 2016 at 16:23, Vincent Carey <stvjc at channing.harvard.edu>
>> wrote:
>>
>> > I am evidently not expert in this topic.  However I was able to get past
>> > the warning/halt you identified by moving the importFrom(bnlearn,...)
>> > statements to the top of the NAMESPACE.  I cannot see in the WRE manual
>> how
>> > the order of namespace imports/exports should be controlled.  Other
>> minds
>> > will be needed to set this straight.
>> >
>> > On Thu, Feb 25, 2016 at 6:06 AM, Luca De Sano <
>> l.desano at campus.unimib.it>
>> > wrote:
>> >
>> >> This is my sessionInfo(), I've the current stable release of bnlearn
>> >> (3.9).
>> >>
>> >> > sessionInfo()
>> >> R version 3.2.3 (2015-12-10)
>> >> Platform: x86_64-pc-linux-gnu (64-bit)
>> >> Running under: Ubuntu 14.04.3 LTS
>> >>
>> >> locale:
>> >>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>> >>  [3] LC_TIME=it_IT.UTF-8        LC_COLLATE=en_US.UTF-8
>> >>  [5] LC_MONETARY=it_IT.UTF-8    LC_MESSAGES=en_US.UTF-8
>> >>  [7] LC_PAPER=it_IT.UTF-8       LC_NAME=C
>> >>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
>> >> [11] LC_MEASUREMENT=it_IT.UTF-8 LC_IDENTIFICATION=C
>> >>
>> >> attached base packages:
>> >> [1] parallel  stats     graphics  grDevices utils     datasets  methods
>> >> [8] base
>> >>
>> >> other attached packages:
>> >> [1] TRONCO_2.4.0      bnlearn_3.9       doParallel_1.0.10
>> iterators_1.0.8
>> >>
>> >> [5] foreach_1.4.3     devtools_1.10.0
>> >>
>> >> loaded via a namespace (and not attached):
>> >>  [1] igraph_1.0.1        graph_1.44.1        Rcpp_0.12.3
>> >>  [4] magrittr_1.5        roxygen2_5.0.1      BiocGenerics_0.12.1
>> >>  [7] munsell_0.4.3       xtable_1.8-2        colorspace_1.2-6
>> >> [10] stringr_1.0.0       plyr_1.8.3          tools_3.2.3
>> >> [13] grid_3.2.3          gtable_0.1.2        R.oo_1.20.0
>> >> [16] withr_1.0.1         digest_0.6.9        gridExtra_2.0.0
>> >> [19] RColorBrewer_1.1-2  Rgraphviz_2.10.0    reshape2_1.4.1
>> >> [22] ggplot2_2.0.0       cgdsr_1.2.5         codetools_0.2-14
>> >> [25] memoise_1.0.0       stringi_1.0-1       R.methodsS3_1.7.1
>> >> [28] scales_0.3.0        stats4_3.2.3
>> >>
>> >>
>> >> --
>> >> Luca De Sano
>> >> tel: +393337177338
>> >> email: l.desano at campus.unimib.it
>> >> PEC: luca.desano at pec.it
>> >>
>> >> On 25 February 2016 at 12:03, Vincent Carey <
>> stvjc at channing.harvard.edu>
>> >> wrote:
>> >>
>> >>> sessionInfo might help.  my guess is that you have an outofdate
>> bnlearn
>> >>> installed?
>> >>>
>> >>> On Thu, Feb 25, 2016 at 5:57 AM, Luca De Sano <
>> l.desano at campus.unimib.it
>> >>> > wrote:
>> >>>
>> >>>> Hi all,
>> >>>> I'm working on a package named TRONCO (
>> >>>> http://bioconductor.org/packages/devel/bioc/html/TRONCO.html ) which
>> >>>> was
>> >>>> released last year on bioconductor. Everytime I run R CMD check I get
>> >>>> these
>> >>>> two warnings:
>> >>>>
>> >>>> * checking whether the namespace can be loaded with stated
>> dependencies
>> >>>> ...
>> >>>> WARNING
>> >>>> Error: .onLoad failed in loadNamespace() for 'bnlearn', details:
>> >>>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>> >>>>   error: no existing definition for function ‘nodes’
>> >>>> Execution halted
>> >>>>
>> >>>> * checking whether the namespace can be unloaded cleanly ... WARNING
>> >>>> Error: .onLoad failed in loadNamespace() for 'bnlearn', details:
>> >>>>   call: setMethod("nodes", cl, function(object) .nodes(object))
>> >>>>   error: no existing definition for function ‘nodes’
>> >>>> Execution halted
>> >>>>
>> >>>> I've searched informations about these errors and I've only found
>> some
>> >>>> old
>> >>>> posts on StackOverflow which suggested to change the order of the
>> >>>> import.
>> >>>> I've tried to do it with no result. At the moment I can't figure out
>> >>>> what
>> >>>> those warnings mean!
>> >>>>
>> >>>> Any suggestions?
>> >>>>
>> >>>> Warnings can be reproduced with the code listed below:
>> >>>>
>> >>>> git clone https://github.com/BIMIB-DISCo/TRONCO.git
>> >>>> R CMD build TRONCO
>> >>>> R CMD check TRONCO_2.3.0.tar.gz
>> >>>>
>> >>>> Thank you
>> >>>>
>> >>>> --
>> >>>> Luca De Sano
>> >>>> tel: +393337177338
>> >>>> email: l.desano at campus.unimib.it
>> >>>> PEC: luca.desano at pec.it
>> >>>>
>> >>>>         [[alternative HTML version deleted]]
>> >>>>
>> >>>> _______________________________________________
>> >>>> Bioc-devel at r-project.org mailing list
>> >>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>> >>>
>> >>>
>> >>>
>> >>
>> >
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioc-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
>
>
>
> --
> Joris Meys
> Statistical consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Mathematical Modelling, Statistics and Bio-Informatics
>
> tel : +32 9 264 59 87
> Joris.Meys at Ugent.be
> -------------------------------
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list