[Bioc-devel] R CMD check problems

Joris Meys Joris.Meys at Ugent.be
Thu Feb 25 17:36:52 CET 2016


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