Mastering Software Development in R
Minimum price
Suggested price

Mastering Software Development in R

About the Book

The world of R has evolved substantially since its early days as a statistical computing language. As the field of data science has rocketed to the forefront of all areas of scientific and industry work, R has become the centerpiece language for doing data science. Through the contributions of a vibrant and highly active developer community, R has evolved to the point where it can be considered a software development language for developing robust, modular, and highly reusable software tools. 

We begin by providing a rigorous introduction to the R language, and quickly move on to more advanced aspects like functional programming, object-oriented programming, building R packages, and software maintainence. We also discuss the development of custom visualization tools through packages like ggplot2 and ggmap. 

This book is about using R to develop the tools for doing data science. Whether you are on a data science team or working by yourself as part of a community of developers or data scientists, you will find this book useful as a reference for the software development process in R. Throughout, we focus on the aspects of the R language that are relevant to developing code and tools that will be used by others. 

Printed copies of the book are available from Lulu (coming soon).

About the Authors

Roger D. Peng
Roger D. Peng

Roger D. Peng is a Professor of Statistics and Data Sciences at the University of Texas, Austin. Previously, he was Professor of Biostatistics at the Johns Hopkins Bloomberg School of Public Health. His research focuses on the development of statistical methods for addressing environmental health problems and on developing tools for doing better data analysis. He is the author of the popular book R Programming for Data Science and 10 other books on data science and statistics. He is also the co-creator of the Johns Hopkins Data Science Specialization, the Simply Statistics blog where he writes about statistics for the public, the Not So Standard Deviations podcast with Hilary Parker, and The Effort Report podcast with Elizabeth Matsui. Roger is a Fellow of the American Statistical Association and is the recipient of the Mortimer Spiegelman Award from the American Public Health Association, which honors a statistician who has made outstanding contributions to public health. He can be found on Twitter and GitHub at @rdpeng.

Roger D. Peng

Episode 16

Sean Kross
Sean Kross

Sean Kross is a software developer in the department of Biostatistics at the Johns Hopkins Bloomberg School of Public Health. Sean's professional interests range between metagenomics, cybersecurity, and human-computer interaction. He is also the lead developer of the swirl, a software package designed to teach programming, statistics, and data science in an authentic programming environment. You can find Sean on Twitter and GitHub at @seankross.

Brooke Anderson
Brooke Anderson

Brooke Anderson is an Assistant Professor at Colorado State University in the Department of Environmental & Radiological Health Sciences, as well as a Faculty Associate in the Department of Statistics. She is also a member of the university’s Partnership of Air Quality, Climate, and Health and is a member of the editorial boards of Epidemiology and Environmental Health Perspectives. Previously, she completed a postdoctoral appointment in Biostatistics at Johns Hopkins Bloomberg School of Public and a PhD in Engineering at Yale University. Her research focuses on the health risks associated with climate-related exposures, including heat waves and air pollution, for which she has conducted several national-level studies. As part of her research, she has also published a number of open source R software packages to facilitate environmental epidemiologic research. 


The Book
  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price
The Book + Code Files + Datasets

This package provides in convenient form the code executed in the book as well as datasets needed to reproduce the examples. In addition, we include a complete HTML version of the book for browsing locally on your computer.


  • extras
    R Code Files
  • extras
  • extras
    HTML Book
  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price

Table of Contents

  • Introduction
    • Setup
  • 1. The R Programming Environment
    • 1.1 Crash Course on R Syntax
    • 1.2 The Importance of Tidy Data
    • 1.3 Reading Tabular Data with the readr Package
    • 1.4 Reading Web-Based Data
    • 1.5 Basic Data Manipulation
    • 1.6 Working with Dates, Times, Time Zones
    • 1.7 Text Processing and Regular Expressions
    • 1.8 The Role of Physical Memory
    • 1.9 Working with Large Datasets
    • 1.10 Diagnosing Problems
  • 2. Advanced R Programming
    • 2.1 Control Structures
    • 2.2 Functions
    • 2.3 Functional Programming
    • 2.4 Expressions & Environments
    • 2.5 Error Handling and Generation
    • 2.6 Debugging
    • 2.7 Profiling and Benchmarking
    • 2.8 Non-standard Evaluation
    • 2.9 Object Oriented Programming
    • 2.10 Gaining Your ‘tidyverse’ Citizenship
  • 3. Building R Packages
    • 3.1 Before You Start
    • 3.2 R Packages
    • 3.3 The devtools Package
    • 3.4 Documentation
    • 3.5 Data Within a Package
    • 3.6 Software Testing Framework for R Packages
    • 3.7 Passing CRAN checks
    • 3.8 Open Source Licensing
    • 3.9 Version Control and GitHub
    • 3.10 Software Design and Philosophy
    • 3.11 Continuous Integration
    • 3.12 Cross Platform Development
  • 4. Building Data Visualization Tools
    • 4.1 Basic Plotting With ggplot2
    • 4.2 Customizing ggplot2 Plots
    • 4.3 Mapping
    • 4.4 htmlWidgets
    • 4.5 The grid Package
    • 4.6 Building a New Theme
    • 4.7 Building New Graphical Elements
  • About the Authors

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub