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.

Channels ▼

Mike Riley

Dr. Dobb's Bloggers

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)

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips 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.