The Book of R

Book of R

A First Course in Programming and Statistics
by Tilman M. Davies
July 2016, 832 pp.
ISBN-13: 
9781593276515

The Book of R is a comprehensive, beginner-friendly guide to R, the world’s most popular programming language for statistical analysis. Even if you have no programming experience and little more than a grounding in the basics of mathematics, you’ll find everything you need to begin using R effectively for statistical analysis.

You’ll start with the basics, like how to handle data and write simple programs, before moving on to more advanced topics, like producing statistical summaries of your data and performing statistical tests and modeling. You’ll even learn how to create impressive data visualizations with R’s basic graphics tools and contributed packages, like ggplot2 and ggvis, as well as interactive 3D visualizations using the rgl package.

Dozens of hands-on exercises (with downloadable solutions) take you from theory to practice, as you learn:

  • The fundamentals of programming in R, including how to write data frames, create functions, and use variables, statements, and loops
  • Statistical concepts like exploratory data analysis, probabilities, hypothesis tests, and regression modeling, and how to execute them in R
  • How to access R’s thousands of functions, libraries, and data sets
  • How to draw valid and useful conclusions from your data
  • How to create publication-quality graphics of your results

Combining detailed explanations with real-world examples and exercises, this book will provide you with a solid understanding of both statistics and the depth of R’s functionality. Make The Book of R your doorway into the growing world of data analysis.

Author Bio 

Tilman M. Davies is a senior lecturer at the University of Otago in New Zealand, where he teaches statistics and R at all university levels. He has been programming in R for 10 years and uses it in all of his courses. In 2017, Davies received Otago's Early Career Award for Distinction in Research.

Table of contents 

Preface

PART I THE LANGUAGE
1 Getting Started
2 Numerics, Arithmetic, Assignment, and Vectors
3 Matrices and Arrays
4 Non-numeric Values
5 Lists and Data Frames
6 Special Values, Classes, and Coercion
7 Basic Plotting
8 Reading and Writing Files

PART II PROGRAMMING
9 Calling Functions
10 Conditions and Loops
11 Writing Functions
12 Exceptions, Timings, and Visibility

PART III STATISTICS AND PROBABILITY
13 Elementary Statistics
14 Basic Data Visualization
15 Probability
16 Common Probability Distributions

PART IV STATISTICAL TESTING AND MODELING
17 Sampling Distributions and Confidence
18 Hypothesis Testing
19 Analysis of Variance
20 Simple Linear Regression
21 Multiple Linear Regression
22 Linear Model Selection and Diagnostics

PART V ADVANCED GRAPHICS
23 Advanced Plot Customization
24 Going Further with the Grammar of Graphics
25 Defining Colors and Plotting in Higher Dimensions
26 Interactive 3D Plots (AVAILABLE NOW)

APPENDICES
A Installing R and Contributed Packages
B Working with RStudio (AVAILABLE NOW)

Bibliography

View the detailed Table of Contents (PDF)
View the Index (PDF)

Reviews 

“You must see this epic work...a game changer.”
Kirk Borne, Principal Data Scientist at Booz Allen Hamilton

“Extremely well written with excellent explanations and examples, this book fully accomplishes the goal of providing the reading with both the programming and statistical skills required to become proficient with this language. I am nothing short of amazed at the consistent quality and clarity of the text and the utility of the exercises.”
Computerworld

"The Book of R is a gentle yet informative introduction to the statistical software environment R. It is for anyone interested in programming, statistics, and data analysis, and is especially well-suited for students and instructors of statistics courses."
—Timothy King, Solutions Review

“I’ve been looking for a book like this for some time. It fills some holes in my course content that my own book doesn’t address.”
insideBIGDATA

“I recommend this book to both beginners, as a good introduction to basic statistics and R, and to intermediate users as a desktop reference to assist in performing day-to-day analysis.”
One R Tip a Day

“Overall, The Book of R is an excellent reference for novice data analysts and for students being introduced to statistical programming tools.”
—Harry J. Foxwell, ACM's Computing Reviews

"Because it has a clearly defined structure, one can easily focus on aspects of specific interest . . . And this is, in fact, what the author intended: to serve a variety of audiences that would be interested in the dual aspects of using R as both a programming language and as a tool for statistical problem solving. In this regard, the book serves these audiences well, including students, researchers, and practitioners of both computing and statistical methods."
—Janusz Zalewski, ACM's Computing Reviews

“The book is therefore addressing two audiences with different needs – coders who might need help with understanding statistical concepts and statisticians of one breed or another who want to learn how to code. Satisfying both groups is a big ask, but Tilman Davies pulls it off.”
Network Security Newsletter

“Davies' book is perhaps the most comprehensive explanation of the core R language in print, and an excellent introduction to using R for statistical programming.”
Oliver Keyes, sociotechnical systems researcher

Updates 

View the latest errata.