The Art of R Programming

Here are my first impressions of The Art of R Programming. I haven’t had time to read it thoroughly, and I doubt I will any time soon. Rather than sitting on it, I wanted to get something out quickly. I may say more about the book later.

The book’s author, Norman Matloff, began his career as a statistics professor and later moved into computer science. That may explain why his book seems to be more programmer-friendly than other books I’ve seen on R.

My impression is that few people actually sit down and learn R the way they’d learn, say, Java. Most learn R in the context of learning statistics. Here’s a statistical chore, and here’s a snippet of R to carry it out. Books on R tend to follow that pattern, organized more by statistical task than by language feature. That serves statisticians well, but it’s daunting to outsiders.

Matloff’s book is organized more like a typical programming book and may be more accessible to a programmer needing to learn R. He explains some things that might require no explanation if you were learning R in the context of a statistics class.

The last four chapters would be interesting even for an experienced R programmer:

  • Debugging
  • Performance enhancement: memory and speed
  • Interfacing R to other languages
  • Parallel R

No one would be surprised to see the same chapters in a Java textbook if you replaced “R” with “Java” in the titles. But these topics are not typical in a book on R. They wouldn’t come up in a statistics class because they don’t provide any statistical functionality per se. As long as you don’t make mistakes, don’t care how long your code takes to run, and don’t need to interact with anything else, these chapters are unnecessary. But of course these chapters are quite necessary in practice.

As I mentioned up front, I haven’t read the book carefully. So I’m going out on a limb a little here, but I think this may be the book I’d recommend for someone wanting to learn R, especially for someone with more experience in programming than statistics.

Related post: R: The Good Parts

8 thoughts on “The Art of R Programming

  1. Thanks. I have a lot of experience with Matlab, and am looking to take up R. This looks like it might work well for me.

  2. I’ll second the warning that most other R books fail to introduce is as a programming language, instead treating it as a black box that you poke by typing things. I looked at the TOC for this book and it could be really good.

  3. Having read through parts of the book my brief summary is that it contains a lot of useful information but falls short of providing an insightful and cohesive way of thinking about R programming. That said, it’s way better than anything else that’s out there (including “R in a nutshell”) and it does provide information on many important topics (e.g.-useful details on debugging, all the approaches to classes except for the new reference classes).

  4. Cássio Pagnoncelli

    This book comes as to be a first-read for programmers going to statistics.
    Although other books cover some topics, none (from the Amazon’s top sellers) of them is entirely dedicated to programming basics, and it is where introduced-programmers lack on.
    I would recommend it as a first R book, and the reason is quite simple: start by the beginning.

  5. I learned R by basically inhaling R in a Nutshell when I needed to move away from SAS for data analysis. Since then I have used R Cookbook, R in Action and a few other R books for reference since most of my use was just “poking the black box” for analytic needs. I did have a reasonable understanding of R as a language from R in a Nutshell, but Art of R Programming really stressed R as a language decoupled from the stats. Having this almost independent discussion of R as a language really improved my code, both functions and script files. I cannot recommend it enough to someone who wants to learn how to really use R as opposed to using it as a FOSS form of SAS/Stata/SPSS/etc.

  6. Anthony Pawlak

    I recently came to R as a quantitative behavioral researcher who is steeped in SAS and SPSS programming. I have been working through several books on statistics using R and took a graduate level course that emphasized the use of R, but even after all that I still felt very uncomfortable using R. I realized that in order to truly feel comfortable with R, I needed something that presented R to me as a programming language. I figured that once I learned how to use R from the ground up as a programming language, I would feel much more comfortable in using R stat packages in general. In this regard, The Art of R Programming has been enormously useful for me. I have no real coding background, and I find this book to be very user friendly and informative.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>