Chapter 1 Introduction

This document includes all the code used in the book. The code is presented in the same order, in the same the sections and sub-sections in which it is found in the hard copy of the book but without any of the commentary. The code for each chapter allows the reader to copy and paste it into the R/RStudio.

When the book was written, all of the code in the book was correct. However, R and its packages are occasionally updated. In most cases this is not problematic as the update almost always extends the functionality of the package without affecting the original code. In a few instances, specific packages are completely rewritten without backward compatibility.

These pages will always be updated to handle these changes (well perhaps until the 3rd edition!) and note that there is no code that generates any outputs in the Introduction chapter.

The full book can be found at the links below:

Please contact us with any questions or suggestions: