[Bioc-devel] Error in cmd check, possibly because examples are executed in wrong order

Martin Morgan martin.morgan at roswellpark.org
Sun Jul 9 00:31:37 CEST 2017


Examples should be stand-alone; collation influences the order in which 
files are included when the package is built, it does not influence 
order of execution of examples. It is still

   https://stat.ethz.ch/pipermail/bioc-devel/2017-June/011138.html

VERY BAD programming practice to write functions whose execution depends 
on the state of the user environment.

Martin

On 07/08/2017 06:08 PM, Arman Sh wrote:
> 
> Hi, cmd check returns error for the package I’m developing. The only possible reason is that it doesn’t check the functions in correct order. This is how Collate section of my DESCRIPTION file looks like.
> 
>                         Collate:
>                             'cbaf-obtainMultipleStudies.R'
>                             'cbaf-obtainOneStudy.R'
>                             'cbaf-automatedStatistics.R'
>                             'cbaf-availableData.R'
>                             'cbaf-heatmapOutput.R'
>                             'cbaf-xlsxOutput.R'
>                             'cbaf-processMultipleStudies.R'
>                             'cbaf-processOneStudy.R'
> 
> and this is how header of my NAMESPACE file looks like:
>                          
>                             # Generated by roxygen2: do not edit by hand
> 
>                             export(automatedStatistics)
>                             export(availableData)
>                             export(heatmapOutput)
>                             export(obtainMultipleStudies)
>                             export(obtainOneStudy)
>                             export(processMultipleStudies)
>                             export(processOneStudy)
>                             export(xlsxOutput)
> 
> I have set the error code in the ‘automatedStatistics’ function so that it occurs if it is excecuted before obtainMultipleStudies or obtainOneStudy. I’m using Roxygen2 for making the package. When I run my code it proceeds without any error, but cmd check somehow can’t execute the  functions in direct order, I guess.
> 
> Since the function should prevent repetitive executions, I use a BiocFileCache to store the output data for every submission and I made the ‘Formal Class BiocFileCache’ available in global environment. I have checked whether this causes the problem but even without pointing to specific environment, cmd check  returns error. More interestingly, I have manually executed the functions in correct order so that BioFileCache object is created. But cmd check still returnes error!
> 
> 
> The following is the cmd check results.
> 
> Thank you very much in advance and with the best regards,
> Arman
> 
> 
> 
> 
> 
> ==> roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace', 'vignette'))
> 
> Updating vignettes
> Documentation completed
> 
> ==> Rcmd.exe build cbaf
> 
> * checking for file 'cbaf/DESCRIPTION' ... OK
> * preparing 'cbaf':
> * checking DESCRIPTION meta-information ... OK
> * installing the package to build vignettes
> * creating vignettes ... OK
> * checking for LF line-endings in source and make files
> * checking for empty or unneeded directories
> * building 'cbaf_0.99.0.tar.gz'
> 
> ==> Rcmd.exe check cbaf_0.99.0.tar.gz
> 
> * using log directory 'Z:/cbaf/Source code/cbaf.Rcheck'
> * using R version 3.4.1 (2017-06-30)
> * using platform: x86_64-w64-mingw32 (64-bit)
> * using session charset: ISO8859-1
> * checking for file 'cbaf/DESCRIPTION' ... OK
> * this is package 'cbaf' version '0.99.0'
> * package encoding: UTF-8
> * checking package namespace information ... OK
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking if there is a namespace ... OK
> * checking for executable files ... OK
> * checking for hidden files and directories ... OK
> * checking for portable file names ... OK
> * checking whether package 'cbaf' can be installed ... OK
> * checking installed package size ... OK
> * checking package directory ... OK
> * checking 'build' directory ... OK
> * checking DESCRIPTION meta-information ... OK
> * checking top-level files ... OK
> * checking for left-over files ... OK
> * checking index information ... OK
> * checking package subdirectories ... OK
> * checking R files for non-ASCII characters ... OK
> * checking R files for syntax errors ... OK
> * checking whether the package can be loaded ... OK
> * checking whether the package can be loaded with stated dependencies ... OK
> * checking whether the package can be unloaded cleanly ... OK
> * checking whether the namespace can be loaded with stated dependencies ... OK
> * checking whether the namespace can be unloaded cleanly ... OK
> * checking loading without being on the library search path ... OK
> * checking dependencies in R code ... OK
> * checking S3 generic/method consistency ... OK
> * checking replacement functions ... OK
> * checking foreign function calls ... OK
> * checking R code for possible problems ... NOTE
> automatedStatistics: no visible binding for global variable 'rawList'
> heatmapOutput: no visible binding for global variable
>    'oldParamAutomatedStatistics'
> heatmapOutput: no visible binding for global variable 'processedList'
> heatmapOutput: no visible binding for global variable
>    'simplifiction.cuttoff'
> heatmapOutput: no visible global function definition for 'redgreen'
> obtainMultipleStudies: no visible binding for global variable 'i'
> xlsxOutput: no visible binding for global variable
>    'oldParamAutomatedStatistics'
> xlsxOutput: no visible binding for global variable 'processedList'
> xlsxOutput: no visible binding for global variable 'validationResult'
> Undefined global functions or variables:
>    i oldParamAutomatedStatistics processedList rawList redgreen
>    simplifiction.cuttoff validationResult
> * checking Rd files ... OK
> * checking Rd metadata ... OK
> * checking Rd cross-references ... OK
> * checking for missing documentation entries ... OK
> * checking for code/documentation mismatches ... OK
> * checking Rd \usage sections ... OK
> * checking Rd contents ... OK
> * checking for unstated dependencies in examples ... OK
> * checking installed files from 'inst/doc' ... OK
> * checking files in 'vignettes' ... OK
> * checking examples ... ERROR
> Running examples in 'cbaf-Ex.R' failed
> The error most likely occurred in:
> 
>> ### Name: automatedStatistics
>> ### Title: Performing the requested statistics for various studies /
>> ###   subgroups of a study.
>> ### Aliases: automatedStatistics
>>
>> ### ** Examples
>>
>> automatedStatistics("test", obtainedDataType = "single study")
> Error in automatedStatistics("test", obtainedDataType = "single study") :
>    Please run one of the obtainSingleStudy() or obtainMultipleStudies() functions first
> Execution halted
> * checking for unstated dependencies in vignettes ... OK
> * checking package vignettes in 'inst/doc' ... OK
> * checking running R code from vignettes ...
>     'cbat.Rmd' using 'UTF-8' ... OK
>   NONE
> * checking re-building of vignette outputs ... OK
> * checking PDF version of manual ... OK
> * DONE
> Status: 1 ERROR, 1 NOTE
> 
> See
>    'Z:/cbaf/Source code/cbaf.Rcheck/00check.log'
> for details.
> 
> 
> Exited with status 1.
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
> 


This email message may contain legally privileged and/or...{{dropped:2}}



More information about the Bioc-devel mailing list