Advanced R : Book Review
There is a difference between an R user and an R programmer. The former is usually concerned with writing R scripts, using existing R libraries, in order to do data wrangling / model development / back testing or creating an reproducible research document. R programmer on the other hand is usually interested in creating a package / reusable code that can be used by others in his company / by R community.
The author of the book, Hadley Wickham, has been one of the biggest contributors of infrastructure and visualization packages in R. In this book, the author does a splendid job of explaining the nuts and bolts of R, the knowledge that he has gained from spending more than two decades building useful R packages.
Given the title, it is pretty obvious that this should not be someone’s first book. But I think this should be read as soon as you get some good enough idea about R. Delaying too much in reading this book might not be a nice idea. Even if you intend to be a R user and not an R programmer, I think it is worth your while to spend time and effort in working through this book. If you are intend to write your own packages either for internal use or for community use, this book is priceless.
I found the content on “non standard evaluation”, i.e chapters 13 & 14, to be extremely well organized. You probably have to spend a lot of time on stackoverflow / read other’s code to get the kind of understanding you get, from reading these chapters. Most of the initial chapters in the book start with a few teaser questions . The author suggests to the reader that she can skip the chapter if she is comfortable with all the questions. My guess is that, even a seasoned R programmer will find some of these questions tricky/ tough to answer and will start working through most of the initial chapters.
This is not a book that you can read over a weekend or even a fortnight. My guess is it will take at least a month or two to understand and reflect on many gems scattered through out the book . If you have used shiny package for any UI development, reading chapter 15 of the book basically gives a good idea of what happens behind shiny. If you want to write a C++ function to speed up things and want to use R to call the function, you will have to slog through chapter 19 that deals with this aspect comprehensively. There are two chapters on functional programming that explain the powerful features of R.
My favorite chapters in the book are the ones on non-standard evaluation. The thing about R is that it can be used as an interactive language as well as a functional programming language. So, whenever you write your code and want it to be extensible, you need to think about quite a lot of things. Just read the source code of any base R function and you will see that it looks very different. There are many tradeoffs that an R developer has to make. What are they ? Such questions and many more about non-standard programming are thoroughly explained in ~ 50 pages. There are also chapters on memory management, code optimization, that will be of immense use to any R user/ programmer.
I think this book can serve as an excellent guide to anyone wanting to be a better R user / R developer. It has tons of useful references that you might want to go over, if you really want to understand the language at a deeper level.