Author: Tilman M. Davies
Publisher: No Starch Press
Audience: R Beginners To Intermediates
Reviewer: Mike James
Other books on R are either about programming or statistics - this one is about both.
This is a big book and it gives the impression that it really is THE book of R. It doesn't try to focus exclusively on the task of teaching you to program or statistics, it does both.
The book is divided into five sections. The first two are about programming, the final three are about statistics. Personally I would have preferred an a more in depth book on programming in R and another one on statistics, but if you really want an encyclopedia then this format will suit you.
Part I: The Language opens with two chapters which follow the fairly standard and obligatory course of telling you about getting R installed and working and then using R as a calculator. In this case the use as a calculator moves on to vectors arguably the basic R data structure. By the end of chapter 2 the book is into its stride with lots of detail. If you want a book that just tells you the concepts then this isn't for you. It is exhaustive.
Chapter 3 moves on to matrices and arrays. This covers everything you could possibly want to do with a matrix including inversion, multiplication and so on. Of course if you just want to use R for simple stats this might be going a bit too far. Chapter 4 deals with the difficult question of the need for non-numeric values in statistical data. This is where you find out about factors before moving on to lists and data frames in the next chapter.
Chapter 6 deals with missing values and other non-numeric special values. In this chapter the idea that R is object oriented is introduced along with the idea of class however the ideas are not explored and you are given a reference to another book. R isn't object oriented in the sense the usual sense and despite having read many accounts of how it is object oriented these generally make me suspect that the authors don't really know what it means. Overall this doesn't matter because R doesn't have to be object oriented in the traditional sense to be a useful programming language - but it would be better if readers weren't misled into thinking it is. R might have objects and classes but only in the sense that every thing is referred to as an object and objects have class labels which tell you what sort of data is being stored.
The section closes with a look at graphics and working with files including writing out plots.
Part II: Programming is structured in a way that will suit the non-programmer. It starts off with using functions and the idea of arguments. Then on to conditions and loops and writing your own functions. The section concludes with a look at exceptions and the idea that if you give things the same name then one of them will mask the other. So ends the look at programming with R and we are ready to examine statistical ideas.
Part III Statistics and Probability starts off with a standard account of elementary statistics - variable type, summary statistics, correlation, simple plots including box and whisker. Then it moves on to probability and we have a brief and fairly standard account of what probability is and what probability distributions are. This section ends with a look at some common distributions.
Part IV Statistical Testing and Modeling ramps up the level by looking at sampling distributions, confidence intervals and significance. This is where most practitioners start to go very wrong and the book explains the ideas at a very superficial level. R is used to carry out the tests and explain what you do, but it isn't used to illustrate the idea of significance to the point that the reader is going to get a strong grip on the idea. The final chapters of the section form a tutorial on linear models - regression, multiple regression and ANOVA. The account is very traditional and doesn't emphasise the idea of a linear model.
The final section, Part V Advanced Graphics, goes into great detail about how you can customize your plots, create 3D graphics and generally do better than a simple Pi chart.
So what we have is a huge book that tells you everything about R, Most R users start by using it to do statistics and then find their way into the language as they meet challenges. Here the author, Tilman Davies, assumes that you want to read a very complete and logical introduction even if you aren't sure why you need to know it just yet. The result is more like a manual than a tutorial. If you already know how to program then this is not going to be a good choice. It is suitable for the programming beginner but only if you want a very plain presentation of the facts. If you don't know statistics then the final three sections present an account of traditional statistics as you might find in any course aimed at practitioners rather than experts.
For me it was a bit too complete and all-embracing - you of course might welcome this. Not a book for everyone interested in R, but it would make a good resource to have on a shelf.
To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.
R in 24 Hours
Getting Started with R
R in Action
The Art of R Programming
A Programmer's Guide to R - Data and Objects