Chapter 12. Licensing

The goal of this chapter is to give you the basic tools to manage licensing for your R package. Obviously, we are R developers and not lawyers, and none of this is legal advice. But fortunately, if you’re writing either an open source package or a package used only within your organization,1 you don’t need to be an expert to do the right thing. You need to pick a license that declares how you want your code to be used, and if you include code written by someone else, you need to respect the license that it uses.

This chapter begins with an overview of licensing, and how to license your own code. We’ll then discuss the most important details of accepting code given to you (e.g., in a pull request) and how to bundle code written by other people. We’ll finish off with a brief discussion of the implications of using code from other packages.

Big Picture

To understand the author’s wishes, it’s useful to understand the two major camps of open source licenses:

  • Permissive licenses are very easygoing. Code with a permissive license can be freely copied, modified, and published, and the only restriction is that the license must be preserved. The MIT and Apache licenses are the most common modern permissive licenses; older permissive licenses include the various forms of the BSD license.

  • Copyleft licenses are stricter. The most common copyleft license is the GPL, which allows you to freely copy and modify the code for personal use, but if you publish modified versions ...

Get R Packages, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.