Jump to ratings and reviews
Rate this book

The R Series

Advanced R programming

Rate this book
An Essential Reference for Intermediate and Advanced R Programmers

Advanced R presents useful tools and techniques for attacking many types of R programming problems, helping you avoid mistakes and dead ends. With more than ten years of experience programming in R, the author illustrates the elegance, beauty, and flexibility at the heart of R.



The book develops the necessary skills to produce quality code that can be used in a variety of circumstances. You will learn:


The fundamentals of R, including standard data types and functions Functional programming as a useful framework for solving wide classes of problems The positives and negatives of metaprogramming How to write fast, memory-efficient code


This book not only helps current R users become R programmers but also shows existing programmers what s special about R. Intermediate R programmers can dive deeper into R and learn new strategies for solving diverse problems while programmers from other languages can learn the details of R and understand why R works the way it does.

"

Unknown Binding

First published October 3, 2014

68 people are currently reading
566 people want to read

About the author

Hadley Wickham

19 books181 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
203 (64%)
4 stars
88 (28%)
3 stars
20 (6%)
2 stars
2 (<1%)
1 star
1 (<1%)
Displaying 1 - 16 of 16 reviews
Profile Image for Andrew Nguyen.
122 reviews5 followers
January 19, 2018
Have you ever had a friend who was mostly functional, but not quite with it? Like, this is a kid that refuses to eat salads with salad dressing and wears shorts when it’s 10 degrees outside. You’re friends for multiple years, but then one day, you finally go to his place and you find out that his parents collect Victorian era dolls and pose them in realistic situations. And then as you stare into the eyes of Sally, the life-size doll enjoying a cup of tea, you realize, with a sense of sadness and acceptance, where your friend's weird quirks come from.

This is how this book made me feel. After using R for several years, I was finally looking under the covers at what made R tick. It isn’t always pretty, but all the quirks that make R so hard to learn if you come from a sane language like python or Java finally have a motivation.

This is actually no indictment of the book itself. Hadley does an admirable job of explaining the differences between R’s THREE object systems (this is particularly insane to me) and their motivations. In fact, Hadley does such a good job describing the motivations behind some of the quirks in R, that some of them even seem like a reasonable idea.

So at the end of the day, will this book make you a better R programmer? Honestly, it depends on who you are. Everyone could benefit from the chapter on data structures, subsetting and functional programming. If you are a day-to-day data analyst, some of the profiling and knowledge of the inner machinations of R could be helpful in edge cases. If you’re a serious R package developer, this stuff is extremely useful.

The chapters on meta-programming were pretty mind-numbingly boring and really only useful in a niche set of cases. Actually, Hadley Wickham himself insists that the metaprogramming chapters of this book are okay to skip. The two best chapters were the chapters on base data structures, functional programming and performance analysis. Even if you have a formal background in these areas, these chapters are the most informative on R’s design philosophy: flexibility is king.

Moreso, the exercises in this book are really top notch. Every question presents a different challenge that makes you think like an R language designer! The questions certainly aren’t easy (no way did I finish all of them), but they will make you think long and hard about the tradeoffs that R had to make.

This is the perfect book for someone who wants to understand R at a level slightly deeper than necessary for an analyst and less than a base R contributor. If you're interested in programming language design or at looking under the hood of R, this book rocks.
176 reviews10 followers
August 15, 2015
I read this book fairly passively over the summer while at work doing lots of R Programming. I also read Hadley's R Packages book.

It's a great read, and I really feel like I understand the depths of R a lot better now than I used to. I can tell when I look back at code in R written last year and now that I have improved a lot. I actually have just bought a paper copy which I will keep on my desk for the forseeable future, although most of my reading was done on the laptop.

This book is written in 4 sections:
1. Fundamentals.
2. Functional Programming
3. MetaProgramming
4. Performance.


For me, all of these were useful, with the exception of Metaprogramming, which was a little bit too hardcore to stick through. Interestingly, I met Hadley as JSM in Seattle and asked him about this, and his advice was just to skip this section. Makes sense, maybe someday I will come back to it.

I don't really consider myself a hardcore programmer, but I do spend a lot of time inside R and on my laptop, so it was really nice having a guide like Hadley to walk me through the different aspects of R programming. He's an incredibly clear writer for covering such a complex topic, and it's pretty obvious how much he knows about the subject. He has a great philosophy, and remains a very inspirational figure in the modern world of statistics.

The fundamentals section was about "my speed", where I understood all of the chapters and was able to work them into my daily practice. The only real difficult chapter in this section was "Environments", which I should probably re-read, as it serves as a foundational chapter for some of the more advanced topics. In particular, I LOVED the data structures and coding style chapters. Understanding these at a deep level helped me more than anything.

The performance chapter was fairly high level and interesting. No doubt I will be returning to it when I start to encounter more bottlenecks next year at school.

Finally, perhaps the gem of the book is the functional programming chapter. I didn't realize how great R was for tasks like this, and I have certaintly striven for writing short, succinct functions. Before reading this book, I didn't really have any sort of strategy for programming other than cranking out the results. Now I see how much beauty there is in it :)




228 reviews6 followers
May 27, 2018
I think I would've enjoyed this book a lot more if I had little more experience in writing R and as the title suggests, this book does talk about a lot of advanced concepts of R. Books like Beginning R by Mark Gardener and The Art of R Programming by Norman Matloff are definite stepping stones.

The internals of R are detailed very well in this book like - three properties of vector, four environments, the difference between [[ and $ and so on. I did have to lookup on help for a few functions since the book doesn't talk about what most of these functions do, only the 'how' of it.

Lexical scoping and method dispatch are so excellently explained, I read it twice just because I enjoyed it so much. Useful packages are mentioned across the chapters. The author is humble about what makes R difficult to learn as well.

As mentioned above, it'll take me some more time to get a grip on R and appreciate this book thoroughly, but nevertheless it did up my knowledge about R - 5 stars for that.
Profile Image for Steve.
39 reviews14 followers
July 7, 2020
The first eight chapters are great, and I picked up a lot of useful information on seemingly basic topics in R that I didn't know before, despite using it almost every day for ~3 years.

The middle sections I didn't find useful other than a few tidbits on the object-oriented systems and some of the evaluation & quotation stuff that falls more into the "nice-to-know" category. If anything, I learned that if I'm interested in making software that isn't in the form of an R package, I will probably use a different language.

Overall, a good and easy to understand book with clear examples, but probably one I won't reference too much unless I end up in an alternate universe where I'm regularly making R packages for consumption. This is a good reference to go from R Analyst/Scientist -> R Developer, or Other Language Developer -> R Developer. If you're like me, and spend most of your time in the very first category, there's not much to gain other than bonus information about what's going on under the hood. Go Cyclones, I guess.
Profile Image for Terran M.
78 reviews106 followers
March 22, 2018
There's a lot of “magic” in how R takes function arguments, searches environments, dispatches polymorphic functions, etc. This is the book that explains how all of the magic works, so that instead of gawping at how somebody else did it in their library, you can do it yourself in your own library.

This book is specifically for people who already know how to use R, and want to be writing R tools for others to use, or just have a personal curiosity about some of the unusual language design choices. If you just want to do analysis in R, you don't need this advanced material.
Profile Image for Pritesh Shrivastava.
80 reviews7 followers
March 11, 2019
I enjoyed reading certain chapters of this book. Others I had to skim through as the material seemed very esoteric. I'm hopeful that I'll get back to those tougher chapters sometime later though.
Profile Image for Ferhat Culfaz.
269 reviews17 followers
March 19, 2019
Quite an Advanced book. More useful as a reference than a general read. You still may not find what you are looking for.
Profile Image for David Lindelof.
44 reviews20 followers
December 2, 2015
I would like to call this the best second book on R, except that I wouldn't know what the first one would be. I learned R from classes and tutorials about 10 years ago, used it on my PhD and four articles, and use it today on a daily basis at work; yet only now, after reading this book, do I feel like I could possibly be called an R programmer rather than just a user.

The book deals with a variety of topics that are seldom discussed in the R tutorials you are likely to find freely available. Some are perhaps unnecessary in a book like this (Ch. 5 Style Guide), some could easily deserve an entire book (Ch. 7 OO field guide), but the chapters on Functions, Environments, the three chapters in Part II (Functional Programming) and the chapter on Non-standard evaluation are easily reasons enough to buy this book.

How many time indeed have you spent hours, frustrated, trying to write a function that would act as a wrapper around, say, lattice plotting functions that use non-standard evaluation? Or try to call subset() from another function, only to see cryptic error messages? Now, for the first time, the solution is not only clear to me; I feel like I could also explain to a colleague why things work the way they do.

R is incredibly powerful and dynamic and will, most of the time, do just what you expect it to do. But if you want to really understand what is going on under the hood, or if you want to write your own packages (whether for self-, internal-, or widespread use), you owe it to yourself to read this book.
4 reviews
June 23, 2020
This book is what will make you transition from R Programmer to R Expert.

A lot of people claim that R is hard to debug and that it also is a very unapproachable language. These feelings are shared by many, and I believe that had they read this book, such sentiments would most surely have changed.

Do not read this book if you do not have a very deep interest for R. This is not a book to show advanced uses of R, but more of a rigorous low-level view of how R works, so you don't get caught up in the R hell.
Profile Image for ifknot.
12 reviews4 followers
June 10, 2016
I approached this as an R dabbler but seasoned programmer and you need to be one or the other to get the most out of this comprehensive explication.
83 reviews2 followers
March 18, 2021
Picked up a few tips and tricks for coding more efficiently in R from this book. A good reference I'll be sure to look back on over time.
Profile Image for Scott Pearson.
833 reviews40 followers
February 10, 2019
Hadley brings an in-depth analysis of the R statistical language in this book and opens up more questions as it enlightens the reader to possibilities with R.

This book is only for the nerds of the nerds as it explores the R programming language, a language used mainly by non-programmers for statistical analysis. As such, the readership for this book is presumably small. Nonetheless, it fills a need as it supplies R users with a textbook for advanced programming.

R is a functional programming language, which means that functions can be passed as arguments in calls to other functions. Hadley shows us, as only a true scientist can, how to take full advantage of this property. He also explores R's underpinnings (R written to implement R functions); R's foundation in another programming language, C; and R's extensions into C++, a third programming language. All this in the name of making R more usable and have better performance.
Displaying 1 - 16 of 16 reviews

Can't find what you're looking for?

Get help and learn more about the design.