Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

# R Cookbook Review

March 24, 2011

I was first exposed to the R language several years ago when looking into Python libraries that could handle sophisticated statistical analysis. My interest in the language was heightened when O'Reilly published R in a Nutshell little more than a year ago. Since then, I have dabbled on and off with R, most recently thanks to the open source RStudio, a cross-platform IDE that helps make R development faster and more rewarding. So the timing is right for O'Reilly to have published their follow up to their Nutshell reference, the R Cookbook by Paul Teetor. Will this latest book on the language further promote its adoption? Read on to find out.

Containing over 200 detailed scenarios and solutions, R Cookbook follows the same Cookbook Problem/Solution/Discussion format that O'Reilly customers have come to expect from the series. After the opening chapter on installing and getting acquainted with R, basic operations such as setting, listing and deleting variables, creating and comparing vectors, and defining functions are covered. And because R can be a bit intimidating and confusing at first blush, an entire chapter is dedicated to navigating and customizing the software. Chapter 4 is where the wheels hit the rails with reading and writing to CSV files.

It isn't until Chapter 5 where the R train wheels meet the rails and the intricacies of constructing and manipulating R elements, lists, matrixes, and data frames are detailed. Data transformations in the form of applying a function to list, row, column, groups, and parallel vectors are demonstrated in Chapter 6. The next chapter covers strings and dates in R, with the usual string operating and date representation/conversion methods. Chapters 8 and 9 cover recipes at the heart of why R exists, namely analyzing probabilities and general statistics, followed by chatters on graphic chart/plot/histogram generation and linear regression and the various Analysis of Variance (ANOVA) statistical operations. Chapter 12 is a collection of useful tips and tricks, such as printing the result of an assignment, selecting every nth element of a vector, and taking function arguments from a list. After that, a chapter on advanced numerics and statistics covers such topics as minimizing/maximizing single and multi-parameter functions, calculating Eigenvalues and Eigenvectors, predicting logistic regression, and more. The final chapter concludes with over 20 time series analysis tips, from plotting time series data to generating forecasts from an Autoregressive Integrated Moving Average (ARIMA) model.

With this broad coverage of R tip goodness, the author has captured a majority of what makes R so interesting to programmers, statisticians, and data analysts. And beyond the basics, the author has also selected a number of really good recipes that show off R's capabilities, especially in the data visualization category. I would have preferred to see a few more tips geared toward incorporating R into applications (such as bridging to it from Java, C#, PHP, or Ruby) as well as examples of automated workflows beyond reading from the MySQL database recipe in the book. Nevertheless, when complimented with Joseph Adler's R in a Nutshell, R Cookbook is a well-written compilation of R exercises that will help any reader appreciate the flexibility and statistical analysis power that the language has to offer.

Title: R Cookbook
Author: Paul Teetor
Publisher: O'Reilly Media
ISBN: 978-0-596-80927-0
Pages: 436
Price: \$31.99 (Ebook), \$39.99 (Print)

### More Insights

 To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.