Search code examples
rdevtoolscran

CRAN checks errors on roxygen @examples: base::assign and missing reshape2


I am trying to push the following package to CRAN, but I keep getting an error on the check.

Error:

✓  checking R/sysdata.rda ...
    WARNING
   ‘qpdf’ is needed for checks on size reduction of PDFs
✓  checking installed files from ‘inst/doc’ ...
✓  checking files in ‘vignettes’ ...
E  checking examples (3s)
   Running examples in ‘oRus-Ex.R’ failed
   The error most likely occurred in:
   
   > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
   > ### Name: analyseStories
   > ### Title: Analysing Stories
   > ### Aliases: analyseStories
   > 
   > ### ** Examples
   > 
   > # Transform the stories
   > fileUrl <- example_stories()
   > stories <- analyseStories(fileUrl, 7)
   Joining, by = "word"
   Joining, by = "word"
   Error in loadNamespace(name) : there is no package called ‘reshape2’
   Calls: analyseStories ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
   Execution halted

Current problems:

  • The example is in orus::analyseStores(...) function.
  • The example actually runs and works on the pkgdown website.
  • The error appears only when doing devtools::check

I have tried multiple things:

I have run out of options. Any idea of what is happening?


Solution

  • As @stefan suggested in the comments, I had to add reshape2 into the Suggested packages in the description file. I added using:

    usethis::usepackage("reshape2", "Suggests")

    Followed by regenerating the docs:

    devtools:document()

    Package is on its way to CRAN!