4

I was building a package that I wanted to submit to CRAN. I completed R CMD checks (using devtools::check()) and ensured that I fix all errors, warnings and notes before I build my package (devtools::build) and then submit the resulting tar.gz file to CRAN.

However, apparently, the package failed the R CMD checks at CRAN (There was one note and one error, as per their mail). Now my question was, why wasn't this picked up when I ran the checks at my end?

To provide some specifics - One of the notes was regarding the usage of a few functions from stats package. I hadn't specifically imported these functions in my namespace.

While this seems to be an easy enough fix, it's mildly irritating (I would have ideally expected to find this while I was running my checks)

How can I avoid such situations in the future?

Thanks!

Thomas
  • 43,637
  • 12
  • 109
  • 140
Dataminer
  • 1,499
  • 3
  • 16
  • 21
  • 2
    There are two ways to check a package, one for general package uploading and use and another set of rules for uploading to cran. You can pass a flag option to the package check --as-cran when you are doing a check via command line, so there is likely an option for doing the same in devtools. – darwin Dec 22 '15 at 17:42
  • @darwin There is a `cran` argument to `devtools::check()`, but it is `TRUE` by default... – joran Dec 22 '15 at 17:44
  • Interesting. And does it return the same diagnostics if you run it command line? – darwin Dec 22 '15 at 17:47
  • 5
    CRAN checks with the development version of R – Jack Wasey Dec 22 '15 at 17:48
  • 3
    Building on what @JackWasey commented, you are required to test against release _and_ devel versions of R before submitting to CRAN. I think that's even in one of the check boxes you may have just clicked through. I usually use a Rocker image on Ubuntu for that, but you can also submit it to the winbuilder service which will check against both. That's as easy as `devtools::build_win()`. Give http://r-pkgs.had.co.nz/ a read as well. – hrbrmstr Dec 22 '15 at 17:54
  • Yes! That was indeed the issue. Infact I detected additional errors when I ran `devtools::build_win()` . Was able to fix them successfully and now the check results came out OK! – Dataminer Dec 22 '15 at 18:28

0 Answers0