Book Review: R Cookbook

The R Cookbook is written by Paul Teetor, a developer with degrees in statistics and computer science, specializing in finance. The programming language R is a specialized language designed for deep statistical research, although it has some support for other mathematical fields, such as matrix algebra and signal processing. True to the O’Reilly cookbook format, this book is written in a pleasant, conversational format, easy to leaf through or read in depth as needed.

For a developer accustomed to procedural or object oriented programming, R is a unique programming language, although not difficult to pick up. Data types are centered around mathematical objects- vectors, matrices, and data tables resembling SQL tables. The IDE is a REPL style command line editor, with sophisticated built in graphing, used at least as much for debugging as displaying output. It’s a very pragmatic language, not heavy on extraneous detail, and has functional language features like closures (although these types of programming language concepts are not the focus of the language or this book)

The author uses personal examples from the finance field, which added an interesting angle for me, being unfamiliar with the types of problems involved. As each chapter is a series of “I have this problem, how do I solve it” examples, one can read the parts that are most interesting. I have an interest in signal processing and AI, and read the last few chapters first, to get an idea of where R shines, and what is considered difficult- this resolved to specialized statistical models (ANOVA/ARIMA), and time series analysis – just what I wanted.

The first few chapters give the just enough syntax examples to get you coding quickly, allowing me to translate a program I’d previously written in Java to R in a few hours (See Detecting pitches in music with R
). Once you get beyond basic programming, several chapters cover common problems encountered in real programs- type conversion, creating different types of graphs, and common stumbling blocks.

The author is clearly well-qualified to teach this language, and the book is written in a pleasant style, as if he were present discussing R with you. I’m a big fan of the O’Reilly Cookbooks series for this reason, as is side-steps the typically mind-numbing boredom induced by most technical literature.

If you have any interest in statistics programming, data analysis, or want a survey of different database programming technologies, the R Cookbook
is a great book to have.