[R-pkg-devel] Including Open-Source C Code in R Package

Dirk Eddelbuettel edd at debian.org
Wed Aug 5 19:21:34 CEST 2015

On 3 August 2015 at 14:54, Zhu, Zijie wrote:
| Hi all,
| I would like to submit a package to CRAN. Now my package includes an
| open-source C model released by some other institution. This
| open-source C model is published under some public license that is not
| in the complete list that CRAN considers valid (link to the list:
| https://svn.r-project.org/R/trunk/share/licenses/license.db)
| Last time I tried to submit the package containing this C model to
| CRAN, but they rejected because of the license problem. Therefore, I
| would like to know if the following is possible, or what is the best
| practice:
| 1. Can I include the open-source C model in my package, in a way that
| can get around the license issue?

You seem to suggest that you can copy the code and put another license on
it. In general you can not: doing so is likely to violate the license.
(Disclaimer: I am not a lawyer, and for real answers you will need one).

| 2. Or, if the above is not feasible, I can split the package in
| halves. Is it possible that I submit "Part A" to CRAN and put "Part B"
| on Github, and when calling `install.packages("Part A")`, "Part B"
| will also be fetched and installed from Github? Currently I have the
| following piece of code in "Part A" to do this:
| .onLoad <- function(libname, pkgname) {
|   if ( ! "Part B" %in% .packages(all.available = TRUE)){
|     devtools::install_github("myrepo/Part B")
|   }
| }
| Is this acceptable to CRAN maintainer, or what is the best practice?

There are several packages on CRAN that use the 'Additional_repositories'
field in DESCRIPTION (see the "Writing R Extensions" manual for details) and
two of these use a drat repo (disclaimer: I wrote drat, and find it useful;
see http://dirk.eddelbuettel.com/code/drat.html for more on drat):

  - lawn
  - wikipediatrend

You could follow their lead and just have the code which CRAN cannot use on
an additional repository. Which drat makes super-easy --- and then it is just
an install.packages() call away.

Note, however, that Additional_repositories works only for Suggests: but not
Depends:  This has implications for how you lay out code in your package.


| Many thanks in advance!!
| Sincerely,
| Miller
| ______________________________________________
| R-package-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-package-devel

http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the R-package-devel mailing list