Book of R

A First Course in Programming and Statistics
by Tilman M. Davies

July 2016, 832 pp.
ISBN: 978-1-59327-651-5

“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.”

Get 30% off with the coupon code DATASCIENCE

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.

    About the Author

    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.

    Table of Contents


    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

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

    13 Elementary Statistics
    14 Basic Data Visualization
    15 Probability
    16 Common Probability Distributions

    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

    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)

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


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



    “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.”

    “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

    “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



    (show updates)(top)