♣A♣Create your own R Package

While this book focuses on the work-flow of the data scientist and it is not a programming book per se; it still makes a lot of sense to introducing you to building your own package. A package is an ideal solution to keep together the functions and data that you need regularly for specific tasks. Of course, it is possible to keep these functions in a file that can be read in via the function source(), but having it all in a package has the advantage of being more standardized, structured and easier to document and so it becomes more portable so that also others can use your code. Eventually, if you have built something great and unique then it might be worth to share it via the “Comprehensive R Archive Network” (CRAN).1

Before we can get started, we need to install two packages first: devtools – that provides the essentials to build the package – and roxygen – that facilitates the documentation. This is done as follows:

devtools is the package that is the workhorse ...

Get The Big R-Book 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.