No Starch Press sent me a copy of The Art of R Programming last Fall and I wrote a review of it here. Then a couple weeks ago, Manning sent me a copy of R in Action (ISBN 1935182390). Here I’ll give a quick comparison of the two books, then focus specifically on *R in Action*.

**Comparing R books**

Norman Matloff, author of *The Art of R Programming*, is a statistician-turned-computer scientist. As the title may imply, Matloff’s book has more of a programmer’s perspective on R as a language.

Robert Kabacoff, author of *R in Action*, is a psychology professor-turned-statistical consultant. And as its title may imply, Kabacoff’s book is more about using R to analyze data. That is, the book is organized by analytical task rather than by language feature.

Many R books are organized like a statistical text. In fact, many *are* statistics texts, organized according to the progression of statistical theory with R code sprinkled in. *R in Action* is organized roughly in the order of steps one would take to analyze data, starting with importing data and ending with producing reports.

In short, *The Art of R Programming* is for programmers, *R in Action* is for data analysts, and most other R books I’ve seen are for statisticians. Of course a typical R user is to some extent a programmer, an analyst, and a statistician. But this comparison gives you some idea which book you might want to reach for depending on which hat you’re wearing at the moment. For example, I’d pick up *The Art of R Programming* if I had a question about interfacing R and C, but I’d pick up R in Action if I wanted to read about importing SAS data or using the `ggplot2`

graphics package.

**R in Action**

Kabacoff begins his book off with two appropriate quotes.

What is the use of a book, without pictures or conversations? — Alice,

Alice in WonderlandIt’s wondrous, with treasures to satiate desires both subtle and gross; but it’s not for the timid. — Q, “Q Who?”

Star Trek: The Next Generation

*R in Action* is filled with pictures and conversations. It is also a treasure chest of practical information.

The first third of the book concerns basic data management and graphics. This much of the book would be accessible to someone with no background in statistics. The middle third of the book is devoted to basic statistics: correlation, linear regression, etc. The final third of the book contains more advanced statistics and graphics. (I was pleased to see the book has an appendix on using `Sweave`

and `odfWeave`

to produce reports.)

*R in Action* includes practical details that I have not seen in other books on R. Perhaps this is because the book is focused on analyzing and graphing data rather than exploring the dark corners of R or rounding out statistical theory.

Kabacoff says that he wrote the book that he wishes he’d had years ago. I also wish I’d had his book years ago.

## Related links

- R programming for those coming from other languages (referenced in
*R in Action*) - Calling C++ from R
- Better R console fonts

Thanks for the review. I’ve had to pick up R lately for some analysis and am nearing the point of buying a book as opposed to continuing to search for solutions online. I’m glad you broke out the book audiences the way you did. You saved me some time.

“It is sometimes possible to use = for assignment, though I don’t understand when this is and is not allowed. Most people avoid the issue by always using the arrow.”

Voodoo programming anyone?

I find it remarkable that carefully defining the R language has not been a high priority. The last time I looked at the “R Language Definition”, the document had “TO DO” comments and phrases such as “it appears that …”. I suppose the code is the spec.