Functional programming and unit testing for data munging with R
Functional programming and unit testing for data munging with R
Free!
Minimum price
$9.99
Suggested price
Functional programming and unit testing for data munging with R

This book is 70% complete

Last updated on 2017-12-27

About the Book

Most of the time spent working on a project is dedicated to preparing data for analysis. In this book, you will learn how to make this very important part of your work more streamlined and reproducible. We will learn about functional programming, unit testing and documenting your code in an automated way with the R programming language. The end goal is to write a package that contains all the needed functions to make your data tidy. This package will be extremely specific to your own needs and data, so you probably will not want to publish it on CRAN, however you can easily share this package with your colleagues or with your future self. This is especially useful if you are part of a project where you get yearly, quarterly or monthly data and need to repeat the same tasks over and over again. Having a thouroughly tested package makes sure that your fresh data gets tidied without any nasty surprises!

The book is still a work in progress. You can read it for free at www.brodrigues.co/fput. You can show your support by buying it on leanpub for any price, but the version on leanpub will not be always up-to-date. This is because I use bookdown to write the book, and converting the html files generated by bookdown to leanpub's markdown takes some time. However, once I'll finish the book, the version on leanpub will of course be completed and well formatted.

About the Author

Bruno Rodrigues
Bruno Rodrigues

Hi I'm Bruno and have been programming with the R language in a professional setting as well as a hobby for quite some time now. When I'm not at work programming in R I'm working on my Phd thesis and in my free time I'm probably either lifting weights, boxing or blogging.

Table of Contents

  • Chapter 1 Why this book?
    • 1.1 Important notice
    • 1.2 Motivation
    • 1.3 Who am I?
    • 1.4 Thanks
    • 1.5 License
  • Chapter 2 Introduction
    • 2.1 Getting R
    • 2.2 A short overview of functional programming
    • 2.3 A short overview of unit testing
    • 2.4 General recommendations to follow this book
  • Chapter 3 Functional Programming
    • 3.1 Introduction
    • 3.2 Mapping and Reducing: the base way
    • 3.3 Mapping and Reducing: the purrr way
    • 3.4 Basic anonymous functions
    • 3.5 Wrap-up
    • 3.6 Exercises
  • Chapter 4 The tidyverse
    • 4.1 Smoking is bad for you, but pipes are your friend
    • 4.2 Getting data into R with readr, readxl, haven and what are tibbles
    • 4.3 Transforming your data with dplyr
    • 4.4 Tidy your data with tidyr
    • 4.5 Functional programming with purrr and purrrlyr
    • 4.6 Special packages for special kinds of data: forcats, lubridate, and stringr
    • 4.7 Exercises
  • Chapter 5 Programming with the tidyverse
  • Chapter 6 Packages
    • 6.1 Why you need your own packages in your life
    • 6.2 R packages: the basics
    • 6.3 Writing documentation for your functions
    • 6.4 Extra files inside your package and dependencies
    • 6.5 Unit test your package
    • 6.6 Checking the coverage of your unit tests with covr
    • 6.7 Wrap-up
  • Chapter 7 Unit testing
    • 7.1 Introduction
    • 7.2 Unit testing with the testthat package
    • 7.3 Actually running your tests
    • 7.4 Wrap-up
    • 7.5 Exercises
  • Chapter 8 Putting it all together: writing a package to work on data
    • 8.1 Getting the data
    • 8.2 Your first data munging package: prepareData

The Leanpub 45-day 100% Happiness Guarantee

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

See full terms...

Write and Publish on Leanpub

Authors, publishers and universities use Leanpub to publish amazing in-progress and completed books and courses, just like this one. You can use Leanpub to write, publish and sell your book or course as well! 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. It really is that easy.

Learn more about writing on Leanpub