Having recently gone through the process of submitting a package to CRAN, I learned a number of things through the multiple submissions that will get my next package (or yours) published faster.
- Most of the package licenses are GPL and require no additional text in the DESCRIPTION file. I chose to license under MIT. In this case, you need to specify
License: MIT + file LICENSEin the DESCRIPTION file and add a file called LICENSE specifying the
- Overcoming packagename : <anonymous>: no visible binding for global variable ‘varname’ – I declared a variable with global scope in my package and used it before assigning a value to it. As soon as I initialize the variable, the message disappeared.
- More URL links in the documentation. For example, I referenced node.js in the Description field of the DESCRIPTION file and was asked to include a URL point to the node.js home page.
devtools::run_examples()is your friend. Most of my errors were in the
#' @examplessection. Instead of R CMD check, executing
run_examplesonly does that part of the check and does it quickly.
- Have examples that work and execute without warnings or errors, not enclosed in
- Add tests – the more the better. Use the testthat package for the testing framework.
- It doesn’t seem possible to include an extra file that is not part of the R package to be used for the examples.
- New rules are added without wide-reaching notification. Subscribe to the R-package-devel mailing list to get the latest set of rules.
- Using any routine that is not part of the base package must now be explicitly specified in the NAMESPACE file. When doing this, care must be taken as Roxygen also writes/rewrites that file.
devtools::build_win()is your other best friend. It provides another environment (Win32/64) to test your package and has a more realistic test environment that is a better match to what the CRAN maintainers use than what exists on my local machine.
- To gain insight into the maintainer environment, add some R command in your package script in the examples section. These statements will get executed and you will receive a link to the output.
- Wait a day before attempting to submit again.