[R-pkg-devel] Packages that depend on third-party binaries

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jan 24 00:27:07 CET 2016


On 23/01/2016 6:12 PM, Titus von der Malsburg wrote:
>
> Hi all,
>
> I have a package that might be useful for a lot of my colleagues.  It
> provides functions for reading a binary file format generated by
> measurement instruments by a specific manufacturer.  Eventually, I would
> like to make this package available on CRAN.
>
> One problem is that this package uses a binary blob provided by said
> manufacturer.  I understand that it is not allowed to include binaries
> in R packages.  The question is, what else can I do?  Are there any
> recommendations or best practices that one should follow in this
> situation?  Any example of existing CRAN packages that deal with this
> problem?
>
> I suppose one solution would be that the R code installs without the
> binary but warns when the user tries to use it without having installed
> the binary.  In this scenario, it would be the user’s responsibility to
> make sure that the binary is correctly installed.  If the user fails to
> do that, the package is completely useless.  Of course this also has
> implications for the sample code in the man pages which is not
> guaranteed to work and will certainly not work on CRAN build servers.

Examples of packages like that are RGtk2 and rjags (for either or both 
of which I might have the capitalization wrong).

You need to be sure your examples don't fail whether or not the 
externals are available.

I think both of those packages list the external dependencies in 
DESCRIPTION, and refuse to load if the dependencies aren't present.  So 
then the examples should all work.

Another approach is to include a function that tests for the presence of 
the externals, and only runs the examples when they will work.

You shouldn't include examples that fail.

I don't know if CRAN will accept your package if it is hard to obtain 
the external software because of license issues.  So you might think 
about distributing such a package to your colleagues and others by a 
less careful channel, e.g. Github.  I tell my students *never* to use 
packages unless they are on CRAN, but you may have no choice.

Duncan Murdoch



More information about the R-package-devel mailing list