0

When running devtools::check(), my package builds with an error that I cannot pinpoint. What debugging options are available when creating R packages? I am looking for something along the lines of browser() on error.

The error is thrown due to an internal package variable that cannot be found. The variable is called 'hg19' and is stored in sysdata.rda.

── R CMD check ─────────────────────────────────────────────────────────────────
─  using log directory ‘/private/var/folders/md/4bf5wym92vsgqfbl4457psw40000gn/T/RtmpgCtpaV/mypackage.Rcheck’
─  using R version 3.6.0 (2019-04-26)
─  using platform: x86_64-apple-darwin15.6.0 (64-bit)
─  using session charset: UTF-8
─  using options ‘--no-manual --as-cran’ (575ms)
✔  checking for file ‘mypackage/DESCRIPTION’
─  this is package ‘mypackage’ version ‘0.0.0.9000’
─  package encoding: UTF-8
✔  checking package namespace information
✔  checking package dependencies (5.9s)
✔  checking if this is a source package
✔  checking if there is a namespace
✔  checking for executable files ...
✔  checking for hidden files and directories
✔  checking for portable file names
✔  checking for sufficient/correct file permissions ...
E  checking whether package ‘mypackage’ can be installed (11.5s)
   Installation failed.
   See ‘/private/var/folders/md/4bf5wym92vsgqfbl4457psw40000gn/T/RtmpgCtpaV/mypackage.Rcheck/00install.out’ for details.

   See
     ‘/private/var/folders/md/4bf5wym92vsgqfbl4457psw40000gn/T/RtmpgCtpaV/mypackage.Rcheck/00check.log’
   for details.

── R CMD check results ──────────────────────────────── mypackage 0.0.0.9000 ────
Duration: 18.8s

❯ checking whether package ‘mypackage’ can be installed ... ERROR
  See below...

── Install failure ─────────────────────────────────────────────────────────────

* installing *source* package ‘mypackage’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error in get(genome) : object 'hg19' not found
Error: unable to load R code in package ‘mypackage’
Execution halted
ERROR: lazy loading failed for package ‘mypackage’
* removing ‘/private/var/folders/md/4bf5wym92vsgqfbl4457psw40000gn/T/RtmpgCtpaV/mypackage.Rcheck/mypackage’

1 error ✖ | 0 warnings ✔ | 0 notes ✔
Julie
  • 1
  • 3
  • 2
    You don't give us much to go on, but could it perhaps be that you need the package identified on that function? Do you use browser() in any of the package functions? – markhogue Aug 23 '19 at 16:13
  • No, because I cannot tell from the error message thrown by ```devtools::check()``` which function is causing the problem. I am looking for a way to identify the problematic function or script without manually looking through all files in my R directory. – Julie Aug 23 '19 at 16:20
  • Can you add the errore message in your question please – Chelmy88 Aug 23 '19 at 16:22
  • @Chelmy88 added the error message. – Julie Aug 23 '19 at 16:33
  • 1
    And what do you have int the files `/private/var/folders/md/4bf5wym92vsgqfbl4457psw40000gn/T/RtmpgCtpaV/mypackage.Rcheck/00install.out` and `/private/var/folders/md/4bf5wym92vsgqfbl4457psw40000gn/T/RtmpgCtpaV/mypackage.Rcheck/00check.log` ? – Chelmy88 Aug 23 '19 at 16:41
  • 1
    Do you have `get(genome)`somewhere in your code? – Chelmy88 Aug 23 '19 at 16:42
  • 1
    I would use `grep` on the source code to look for `get(genome)` ... – Ben Bolker Aug 23 '19 at 18:10
  • can you point us to a public copy of your package code? (GitHub is hard to search for "get(genome)", but I did find https://github.com/cnobles/iGUIDE/blob/7075a00bcb40c691d5d9cf19489dd145cebd0499/tools/rscripts/generate_iGUIDE_report.R ... – Ben Bolker Aug 23 '19 at 18:14
  • @BenBolker here it is: https://github.com/jlaffy/infercna . genome is the string "hg19", whose corresponding variable is stored in sydata.rda – Julie Aug 25 '19 at 18:18

0 Answers0