Programming book I wish someone would write: R, The Good Parts

Douglas Crockford’s book JavaScript: The Good Parts is terrific. Crockford is both a critic of and advocate for JavaScript. He’s quite frank about the language’s faults. His book is the clearest exposition of the pitfalls of JavaScript that I’ve seen. But he also believes there’s a great language at the heart of JavaScript. He doesn’t just complain about the bad parts; he explains how to avoid them. He has identified his recommended subset of the language. He has written programming style guide intended to increase the chances that JavaScript code does what the programmer intends. And he has written a tool, JSLint, to warn of potential problems. (Crockford reminds me of Luke Skywalker, convinced that there is good in Darth Vader and determined to rescue him from the dark side of the force.)

I wish someone would write a book for R analogous to the one Crockford wrote for JavaScript.

The R language has a lot in common with JavaScript. Both are Lisp-like languages at their core with C-like syntax. Both are dominant languages in their respective niches: R in academic statistics and JavaScript in web browsers. (R doesn’t have the monopoly in statistics that JavaScript has in the browser, but it’s still pervasive.) Both languages are powerful but maddening to debug. JavaScript has an undeserved reputation for being ugly because it is typically used to program the browser DOM; it’s the DOM that’s buggy and non-standard, not JavaScript. Similarly, R’s reputation may suffer from the numerous poorly written modules implemented in R.

Related posts:

9 thoughts on “Programming book I wish someone would write: R, The Good Parts

  1. Bill the Lizard

    I was flipping through JavaScript: The Good Parts about a week ago looking for a quote for an answer on Stack Overflow. I caught myself wishing Crockford would write books on Perl, Java, C++, PHP, … pretty much any language in widespread use. It’s a great idea to have someone knowledgeable tell you explicitly what language features to avoid using. So many books try to illustrate every feature of a language in an effort to be the “X Language Bible”. I hope more authors embrace Crockford’s style.

  2. Bill, I agree. It’s hard to find books that are small because the authors thought hard about what to include and resisted the urge to include everything they know.

    Here’s another good small book: The Essence of SQL

  3. Steve Lianoglou

    In case you haven’t stumbled upon it yet, I think The R Inferno [PDF], is a must read for any R user … it’s both informative and entertaining. With an abstract like “If you are using R and you think you’re in hell, this is a map for you”, how can you go wrong :-)

    Patrick Burns also has some other tutorials that are handy that you can get from his site.

  4. I second the recommendation of the ‘The R Inferno’. It’s a wonderful document, and I have learned so much from it that would have taken years to learn ‘the hard way’. I almost think it should be required reading for every R user.

  5. I think the Inferno covers the “R, The Bad Parts” area; I agree that I would like to see a complement that addresses the areas in which it excels. I think it would have to cover the apply() family and the ease of writing ad hoc functions.

    I agree that there is some poorly written and maintained code available for R – I know I’ve written my fair share – but the flexibility and adaptability that comes from R being an open source product is it’s best feature. It’s why it will succeed over slower moving more expensive packages. It would be nice not to have to deal with bad programming or unmaintained code, but the alternative is worse.

  6. And why stop there? Every language has its strengths and weaknesses. The advocates naturally stress the strengths, but it is knowing the weaknesses that separates the master from the apprentice. This could be a whole series of books: The Jedi Guide to : Use the Force and Avoid the Dark Side

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>