Licensing R Packages that Include Others Code

R packages open-science licensing

I wanted to include others code in my package, and couldn’t find any good resources.

Robert M Flight
2018-02-14

TL;DR

If you include others code in your own R package, list them as contributors with comments about what they contributed, and add a license statement in the file that includes their code.

Motivation

I recently created the knitrProgressBar package. It is a really simple package, that takes the dplyr progress bars and makes it possible for them to write progress to a supplied file connection. The dplyr package itself is licensed under MIT, so I felt fine taking the code directly from dplyr itself. In addition, I didn’t want my package to depend on dplyr, so I wanted that code self-contained in my own package, and I wanted to be able to modify underlying mechanics that might have been more complicated if I had just made a new class of progress bar that inherited from dplyr’s.

I also wanted to be able to release my code on CRAN, not just on GitHub. I knew to accomplish that I would have to have all the license stuff correct. However, I had not seen any guide on how to license a package and give proper attribution in the Authors@R field.

Note that I did ask this question on StackOverflow and ROpenSci forums as well.

Information from CRAN

I should note here, that the CRAN author guidelines do provide a small hint in this regard in the Writing R Extensions guide:

Note that all significant contributors must be included: if you wrote an R wrapper for the work of others included in the src directory, you are not the sole (and maybe not even the main) author.

However, there is not any guidance provided on how these should ideally be listed.

Full Answer

I am the main author and maintainer of the new package, that is easy. The original code is MIT licensed, authored by several persons, and has copyright held by RStudio.

My solution then was to:

So the Authors@R line in my DESCRIPTION ended up being:

Authors@R: c(person(given = c("Robert", "M"), family = "Flight", email = "rflight79@gmail.com", role = c("aut", "cre")),
            person("Hadley", "Wickham", role = "ctb", comment = "Author of included dplyr fragments"),
            person("Romain", "Francois", role = "ctb", comment = "Author of included dplyr fragments"),
            person("Lionel", "Henry", role = "ctb", comment = "Author of included dplyr fragments"),
            person("Kirill", "Müller", role = "ctb", comment = "Author of included dplyr fragments"),
            person("RStudio", role = "cph", comment = "Copyright holder of included dplyr fragments"))

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/rmflight/researchBlog_distill, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Flight (2018, Feb. 14). Deciphering Life: One Bit at a Time: Licensing R Packages that Include Others Code. Retrieved from https://rmflight.github.io/posts/2018-02-14-licensing-r-packages-that-include-others-code/

BibTeX citation

@misc{flight2018licensing,
  author = {Flight, Robert M},
  title = {Deciphering Life: One Bit at a Time: Licensing R Packages that Include Others Code},
  url = {https://rmflight.github.io/posts/2018-02-14-licensing-r-packages-that-include-others-code/},
  year = {2018}
}