bayesImageS available on CRAN
My R package was rejected the first time, due to an old bug in RcppArmadillo (details below). I also forgot to add ‘cran-comments.html’ to my .Rbuildignore after following Hadley Wickham’s otherwise excellent advice on how to develop a package for CRAN. The source package and Windows binaries are now available, with OS X soon to follow. Using R-hub was definitely helpful, since it allowed me to test my package on various flavours of Linux and versions of R before submitting it. The NOTEs didn’t come as a surprise, since running rhub::check_for_cran had already made me aware of them. Hopefully R-hub will add support for Mac OS and SPARC Solaris soon. My code has multiple compile errors in Solaris Studio 12.3, which would be painful to fix without access to a virtual machine. Continuous integration with Travis might also have been useful, but my code is hosted on Bitbucket not GitHub.
The dependency issue with callr that I mentioned in my previous post seems to occur with any version of R prior to 3.3.x, including Microsoft R Open (MRO). As with OS X, upgrading to the latest release of R fixes this issue.
I’ve rewritten my package vignette to use listings instead of algorithm2e or algorithmicx to format the pseudocode for intractable likelihoods. I’m not completely happy with how this looks, but following some advice from StackExchange I’ve managed to produce something readable. If you compare the current vignette with the paper on arXiv, you’ll see what I mean. I’ve also used subcaption for the figures and amsfonts for equations. Note that the subfigure and subfig packages on CTAN are now considered obsolete.
The DESCRIPTION and NAMESPACE files for bayesImageS were originally generated by RcppArmadillo::package.skeleton, but it seems that the preferred method for linking to the Armadillo linear algebra library has changed over the years. When I run R CMD check –as-cran I get the following note:
* checking CRAN incoming feasibility ... NOTE New submission * checking package dependencies ... NOTE Package in Depends/Imports which should probably only be in LinkingTo: ‘RcppArmadillo’ Status: 2 NOTEs
On CRAN, I can see that there are a ton of packages listed in the reverse LinkingTo, but only 4 packages in reverse Imports and 3 in reverse Depends. However, if I remove RcppArmadillo from Depends/Imports I get an ERROR instead of a NOTE:
* checking package dependencies ... ERROR Namespace dependency not required: ‘RcppArmadillo’
This was really frustrating. It looks like the bug has now been fixed in both RcppArmadillo and RcppEigen, but there are no clear instructions on how to produce a working DESCRIPTION and NAMESPACE if you were unlucky enough to run package.skeleton using an old version of either of those packages. Removing RcppArmadillo from LinkingTo just resulted in a compile error:
In file included from PottsUtil.cpp:20:0: PottsUtil.h:23:27: fatal error: RcppArmadillo.h: No such file or directory #include <RcppArmadillo.h> ^ compilation terminated. make: *** [PottsUtil.o] Error 1 ERROR: compilation failed for package ‘bayesImageS’
I submitted my package to CRAN with this NOTE, but it was rejected. I ended up fixing the problem by trial and error:
Imports: Rcpp (>= 0.10.2) LinkingTo: Rcpp, RcppArmadillo
exportPattern("^[[:alpha:]]+") importFrom(Rcpp,evalCpp) useDynLib(bayesImageS)
By deleting RcppArmadillo from both Imports and NAMESPACE, I managed to produce a working version of my R package that passes check_for_cran with flying colours: