R In a Nutshell 91
joel.neely writes "R is a statistical computing environment that is fully-compliant with state-of-the-art buzzwords: free, open-source, cross-platform, interactive, graphics, objects, closures, higher-order functions, and more. It is supported by an impressive collection of user-supplied modules through CRAN, the 'Comprehensive R Archive Network.' And now it has its own O'Reilly Nutshell book, R in a Nutshell, written by Joseph Adler. I am pleased to report that Adler has risen to the challenge of the highly-regarded 'Nutshell' franchise. As is traditional for the series, this title mixes introduction, tutorial, and reference material in a style that is well suited to a reader who already has a background in programming, but is a new or occasional user of R." Read on for the rest of Joel's review.
As a curious newcomer to R who wanted to get going quickly, I was well-served by Part 1, which provided an R kickstart. Chapter 1 covers the process of getting and installing R. It is short, to the point, and just works, addressing Windows, Mac OS X, and Linux/Unix with equal attention. Chapter 2, on the R user interface, introduces the range of options for interacting with R: the GUI (both the standard version and some enhanced alternatives), the interactive console, batch mode, and the RExcel package (which supports R inside a certain well-known spreadsheet). Chapter 3 uses a set of interactive examples to provide a quick tour of the R language and environment, establishing a task-oriented theme that carries through the rest of the book. The last chapter of part 1 covers R packages. It summarizes the standard pre-loaded packages, introduces the tools to explore repositories and install additional package, and concludes by explaining how to create new packages.
R in a Nutshell | |
author | Joseph Adler |
pages | 672 |
publisher | O'Reilly |
rating | 9/10 |
reviewer | Joel Neely |
ISBN | 978-0-596-80170-0 |
summary | A practical and engaging introduction to the R statistical system and its usage |
As a polyglot programmer who is always interested in seeing how a new language approaches programs and their construction, I enjoyed Part 2, which described the R language. This section begins with an overview in chapter 5, and then devotes a chapter each to R syntax, R objects, symbols and environments (central to understanding the dynamic nature of R), functions (including higher-order functions), and R's own approach to object-oriented programming. This section closes in chapter 11, with a discussion of techniques and tips for improving performance.
As a busy professional with data sitting on my hard drive that I'd like to understand better, I appreciated Part 3, with its practical emphasis on using R to load, transform, and visualize data. Chapter 12 presented alternatives for loading, editing, and saving data, from the built-in data editor, through file I/O in a variety of formats, to a mature set of database access options. Chapter 13 illustrated a range of techniques for manipulating, organizing, cleaning, and sorting data, in preparation for presentation or more detailed analysis. Chapter 14 introduces the reader to the wealth of graphical presentation options built into the R environment. There are so many charting types and details that this chapter could have been overwhelming, but Adler keeps the interest high and the mood light by drawing on an engaging variety of data: toxic chemical levels, baseball statistics, the topography of Yosemite Valley, demographic data, and even turkey prices. Chapter 15 is devoted to lattice graphics, the R implementation of the "trellis graphics" technique for data visualization developed at Bell Labs. This chapter illustrates the power of lattice graphics by exploring the question of why more babies are born on weekdays than weekends.
As a non-statistician who still occasionally needs to do some number-crunching, I'm sure I'll be returning to Part 4, with its detailed explanations and illustrations of analysis tools and techniques–almost two-hundred pages worth. In chapters 16 through 20, Adler surveys topics in data analysis, probability, statistics, power tests, and regression modeling. As someone who has been offered too many medications and lost fortunes, I found much to enjoy in chapter 21, which used a variety of spam-detection techniques to illustrate the concepts of classification. Chapter 22, on machine learning, discusses several of the data mining techniques that R supports. Chapter 23 covers time series analysis, which may be used to identify trends or periodic patterns in data. Finally, chapter 24 offers an overview of Bioconductor, an open-source project focused on genomic data.
The book closes with a detailed reference to the standard R packages.
This is an impressive piece of work. In a volume of this size (about 650 pages), navigation is crucial, and I found both the organization of the chapters and index up to the task. I was able to follow the instructions and examples through the first several chapters of the book essentially without a hitch, and in the latter chapters the variety of illustrations and data sources added interest to what could have been very dull going.
I won't claim perfection for this book. There were a couple of explanations that could have been clearer, and one or two odd turns of phrase or rough edits. Out of all the code examples that I tried, I found exactly one that didn't seem to work without a minor correction. For a work of this size, that's actually pretty amazing!
As a long-time O'Reilly reader, I see Joseph Adler's R in a Nutshell as a welcome addition to the menagerie.
You can purchase R in a Nutshell: A Desktop Quick Reference from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
ebook version (Score:4, Informative)
As an (occasional) R user, I am excited to see a well-reviewed O'Reilly book on the language. I went and checked the major ebook stores - Amazon, BN, and Stanza, and none had the title.
It turns out that in addition to the Safari books service, O'Reilly also sells DRM-free copies in epub, mobi, and PDF formats. This book is available here [oreilly.com]. It's not a huge discount over the printed version on Amazon ($6.50 less), though. I'm surprised, then, that it isn't available via the major stores.
Re:Emphatic Agreement (Score:3, Informative)
It handles data nicely. You can do things similar to list comprehensions in python. Implementing it in another language would break its semi-compatibility with S-plus. It also has data-types aimed towards the sorts of processing that it is designed for, like formula objects and data frames. Finally, the interactive mode is invaluable for exploratory analysis.
You could build a ton of syntactic sugar into another language to get something close to R, in-fact, that's actually what basically all of the operations in R are (syntactic sugar, as described in R In A Nutshell).
So to answer your question, it makes more sense to design a language for statistics rather than hack it onto an existing language.
Another outstanding reference for R: "R in Action" (Score:4, Informative)
Not having read the O' Reilly book,
I can't draw a comparison between the two, but I have been extremely pleased with "R In Action" by Robert Kabacoff
and it can be found here:
http://www.manning.com/kabacoff/ [manning.com]
It's a work in progress, in that some 90% of the book is written. Pre-ordering the electronic version gives you the ability to download chapters as they are written, plus a final e-copy (or hard copy if you pay more) when it's completed.
I have a high degree of familiarity with SPSS and SAS, and am learning R to get around the crazy licensing issues of the aforementioned programs. I have been very pleased with Kabacoff's book, as I had *no* familiarity with R before grabbing "R in Action." The publisher/author support a forum where purchasers can identify errors and/or make suggestions for improvements before the book goes to final press.
Not sure if it is competition for "R in a Nutshell" or simply an additional reference, but worth checking out if you want to learn R. It's been very helpful for me.
jeff
Re:Emphatic Agreement (Score:3, Informative)
Re:Question about integration with other languages (Score:3, Informative)
JRI sounds like you want, but rJava is there when you want the reverse.
http://rosuda.org/JRI/ [rosuda.org]
http://rosuda.org/rJava/ [rosuda.org]
Similar things exist for Python, Perl and probably others.
Rattle for R baseed datamining (Score:3, Informative)
Often reason people get involved in statistical analysis is there is a body of data, and no clue where to start ... as inhabitants of the information age, and cheap storage ... there's lots of material and often little clue or thought to what the stored data might mean.
http://rattle.togaware.com/ [togaware.com] is a website dedicated to "rattle" which is an R package (and togaware has a PDF book that's a great introduction) to a GUI based datamining tool.
Very handy, and the book is very lucid.
Comment removed (Score:2, Informative)
Re:Oh God, A GNUFreak... (Score:2, Informative)
R in a nutshell = Rpy (Score:4, Informative)
and honestly, i'm so glad i don't have to use R directly... TFS says it is object oriented, but as far as I can recall all the library methods i tried just returned heterogeneous matrixes, with no real user-defined types. And the function calling semantics are mind-boggling, with mixing of keyword and positional arguments leading to all sorts of weirdness...
Re:R in a nutshell = Rpy (Score:2, Informative)
Sadly, no. As the other guys said, R does absolutely everyting you claim it doesn't. Every positional function argument is a shortcut you can call explicitly in any order. Don't put any stock into this recommendation.
If you are working in python, have discovered that SciPy's stats functions are not ready for prime time (they aren't), and need drop-in replacements, use rpy. Otherwise, you will find it does not play very well with R. It feeds and returns objects in what I found unintuitive and unuseful ways. Yes, you can make it work, so if you're in python already, you should use it. Otherwise, learn and use R when it makes sense, which is roughly 90% of the time doing data analysis.