Skip to content

bayesImageS available on CRAN

November 4, 2016

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 al­go­rith­micx 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:

DESCRIPTION

Imports: Rcpp (>= 0.10.2)
LinkingTo: Rcpp, RcppArmadillo

NAMESPACE

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:

Perhaps they should add a new function to RcppArmadillo and RcppEigen, something like fix_broken_package?
Advertisements

From → R

One Comment

Trackbacks & Pingbacks

  1. Fixing compile issues on SPARC Solaris | Matt Moores

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Let's Look at the Figures

David Firth's blog

Nicholas Tierney

Computational Bayesian statistics

One weiRd tip

Computational Bayesian statistics

Series B'log

discussion blog for JRSS Series B papers

Mad (Data) Scientist

Musings, useful code etc. on R and data science

R-bloggers

R news and tutorials contributed by (750) R bloggers

Another Astrostatistics Blog

The random musings of a reformed astronomer ...

Darren Wilkinson's research blog

Statistics, computing, data science, Bayes, stochastic modelling, systems biology and bioinformatics

CHANCE

Computational Bayesian statistics

StatsLife - Significance magazine

Computational Bayesian statistics

(badness 10000)

Computational Bayesian statistics

Igor's Blog

Computational Bayesian statistics

Statisfaction

I can't get no

Xi'an's Og

an attempt at bloggin, nothing more...

Sam Clifford

Postdoctoral Fellow, Bayesian Statistics, Aerosol Science

Bayesian Research & Applications Group

Frontier Research in Bayesian Methodology & Computation

%d bloggers like this: