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.
Emphatic Agreement (Score:5, Interesting)
In a volume of this size (about 650 pages)
Not to criticize the reviewer but there's not enough written above to do this book justice. From the author's emphasis on preprocessing the data in another language (like Perl I think he uses in the Chapter 3 tutorial) so that it can be effortlessly ingested by R to the very last pages on machine learning in R, it's a good book. I actively lament that in college I was relegated to Matlab instead of R today and the many packages available on CRAN.
I too would give this book a 9/10. It sometimes tries to inject tutorials in what should probably stick to being a reference and it might have too large of a scope for a single volume (I've read sets of books on machine learning and classification models) but this book is great for R beginners and R intermediates and as an R reference.
Seriously if you know a statistician who codes or if you know a developer who values statistics then this is their book. Given the nature of the subject matter and the GPL'd beauty of R, you'll undoubtedly have a hard time finding a negative review of this book anywhere.
Re: (Score:2)
I don't own the book myself but a buddy of mine does, and he has also recommended it. It's funny that you mention Baseball Hacks - this friend of mine started using R for a new kind of statistical analysis of the World Cup here not long ago, and it actually is quite impressive with what he's come up with.
Anyways - Of the few pages I've skimmed it was pretty good. I'd definately be a beginner, having only taken one stats course, but I could understand what was on the page and what the tutorials were teaching
Re: (Score:3, Funny)
The letter R is under the GPL license, therefore any derivative work that uses the letter R, such as Hamlet, the US Constitution, the Forums section of Penthouse magazine, and this post grant the reader the same rights and privileges afforded to a three year old putting a single magnetic letter R on a refrigerator.
Pirates (Score:2, Funny)
Re: (Score:2)
therefore any derivative work that uses the letter R...
Yeah, you think this is funny until you try to google any particular bit of specific info on 'R'.
And don't get me started on looking up using 'R' with 'c'. (actually, that one works much better than it used to).
Re: (Score:2, Informative)
Re: (Score:2)
Google "R language", or "R code", or something similar. It's search engine searching 101.
Thank you very much for your extremely useful skills. I never would have guessed! If you think I haven't tried dozens of permutations of same and not constantly come up with hits based on stray letter 'R's, well... you haven't really done anything challenging with a search engine before. (I'm not talking about cases where you're trying to just get basic facts about R, but when you want to look up some arcane error messages etc. that the stray R's doom many searches).
Re: (Score:1)
Re: (Score:2)
Re: (Score:2, Informative)
Re: (Score:1)
First I would like to add that the author is also the author of Baseball Hacks [oreilly.com], which might not sound like a popular title for Slashdot but if you are a nerd and techie/programmer then this book is for you!
I once developed baseball software for collecting data and then reporting the stats. I could never understand why all that data was collected and why those stats were calculated for the players. I guess it's part of the game to watch someone hit another home run or steal a base or strike out and imagine the stats changing - I seems to be a waste of time.
If folks who follow all those stats put that time and effort to the stock market, they'd all be millionaires.
Re: (Score:2)
No, actually, they wouldn't.
But I can introduce you to a lot of others who also seem to think so.
Re: (Score:1)
Sean Forman (the guy who built baseball-reference.com) is by no means rich. But he was able to walk away from a tenured professorship (Math).
If you're talking the guys who compile the raw data, they're basically people who like to keep score while they watch the game. I know several people who are scorers for Stats (speaking of which, the guy who started that company made millions) or other data sources.
Then there are the people who are transcribing the historical data at retrosheet. These are all volunteer
Re: (Score:2)
Re: (Score:2)
I had a stats course about 3 years ago - and so I mean I understand how to do them but I don't remember the formula's off hand like a stats major probably would. It's difficult to say exactly how much of that course I retained exactly.
But in the few pages I read - I was able to follow along quite easily. I guess the best way to put it is: You have to have some understanding of Statistics and how they work, some familiarity with it, you won't be lost in it.
Whether or not it will be USEFUL to you is another t
Re: (Score:2)
My guess is that if you aren't terribly familiar with statistics, you won't be entirely comfortable writing in a language designed to process complex statistical calculations.
If the book is good enough that it can teach you stats, this guy deserves a Pulitzer, not a 9/10 from Slashdot.
Re: (Score:2)
I'm replying to you, since you seem familiar with R, but hopefully others can chime in as well.
You imply that it's preferable to preprocess the data in another language, like Perl. What makes R valuable as a completely separate language, rather than being implemented as a library within an existing language? I'm assuming there must be something compelling you can't get out of adding
use R;
R::some_func(...);
to your parsing code.
Re: (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 operatio
Re: (Score:2)
I have only limited experience with R, but FWIW, R contains some basic data importation routines for standard things like CSV or tab delineated data. There are also libraries that let you import files from other statistical packages like Stata, SPSS, etc. I imagine you could directly import XLS with a library, though I've never had to.
I would hazard a guess and say that if you had to massage your data into a more machine-readable format, it'd be easier to do it in Perl, then load the result up into R, since
Re: (Score:3, Informative)
I predict "R" apps will be susceptible to piracy (Score:3, Funny)
Re: (Score:2)
I mean, how can they resist?
"R" is resistance, so R apps should be able to resist just fine.
So is the next major version... (Score:3, Funny)
going to be called R-square?
Re:So is the next major version... (Score:4, Funny)
R dR R.
Re: (Score:1)
Simpsons... R^3DR^2 => R R R D R R
Re: (Score:1)
Re: (Score:2)
Avast.
Re: (Score:1)
So...you're making money off Facebook?
Re: (Score:2)
R Tools (Score:4, Interesting)
as a longtime slashdot reader (Score:2)
Let me just say: wow, thanks for actually providing a review, rather than a blurb copied from the amazon listing.
Seriously. Thanks.
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: (Score:2)
Does O'Reilly sell any of its books through ebook intermediaries? Since they sell DRM-free versions direct, usually in multiple formats, I've never bothered to look. The only exception I've noticed is the occasional iPhone app.
As for price, discounts aren't too hard to find. I ordered one book for half its listed ebook price. I've since gotten a couple of "deal of the day" ebooks for $10 each. Today's deal, listed prominently at oreilly.com [oreilly.com], is Learning the vi and Vim Editors (PDF only, unfortunately).
Re: (Score:2)
I've noticed a few have Kindle versions, but Stanza and its store has nearly the entire library. I guess this way O'Reilly gets the full purchase price rather than 70%.
Re: (Score:2)
They sell some titles through the Android app store - but of course, that would probably count as a direct sale too. I'd like to get this book there but for some reason they mostly seem to sell Windows-related titles and not much else.
What language do pirates code in? (Score:4, Funny)
<drops pin...>
Fantastic book for a fantastic language (Score:3, Interesting)
This book always sits right on my desk.
R is a language that more people should really learn. The statistics community has definitely gravitated strongly to it. These days, with the thousands of packages on CRAN, it's much superior in functionality compared to other packages like STATA or SAS (I won't even go into people who use matlab for statistics), not to mention open source.
It still is a bit slower than matlab for some matrix operations, but hopefully that will be improved in the future.
Not much left! (Score:3, Funny)
Based on Wikipedia, only G, H, N, O, P, U, V, W one-letter programming language names are left! Time to invent a new language :)
Re: (Score:2)
Let me take this opportunity to say that unicode can fuck right off.
Re: (Score:1)
V was a voice processing language in the early 90s (Score:2)
:V (the dots were above it) -- was a cross platform byte-code compiled language used for voice processing applications (DOS & Unix)
Re: (Score:2)
Result of programming in G [google.com]: several hits. Maybe wikipedia needs to be updated?
Re: (Score:2)
Re: (Score:2)
That's where Big-O notation came from.
Re: (Score:2)
Personally, I am waiting for R++. I heard it's gonna have templates, operator overloading, the lot!!!
Wonderful software (Score:2)
More than a decade ago I gave a talk on using R, Octave, MuPAD and other software in the classroom environment. It's a great package. Back then I used it to get through stats courses and plot disk usage in a graph. Now I'm using it to hammer through stock market data each night. To do the same with some commercial packages would cost thousands of dollars.
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
Question about integration with other languages (Score:1)
Is there a way to integrate R programs with another high level language like Java, for example to bind a R object to a Java interface? I have basic familiarity with R, and I would like to use programs written in R directly with other programs written in a object-oriented language, as opposed to do file i/o for the bridge between them.
The general idea is to be able to take Java objects and pass them to R and do all the stats numbercrunching with smaller R programs, that are somehow integrated with a Java pro
Re: (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.
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: (Score:1)
R does support fully user-defined types, inheritance and polymorphic methods. You just have to want to use them enough to dig through the multiple OO implementations available as part of the core. The commonly used systems, S3 and S4 objects, don't exactly play nicely together. I personally lean towards S4 since it seems much cleaner, but a lot of legacy code still uses S3 so it looks like there won't be a rationalisation of these two systems any time soon. The Bioconductor R modules generally (but not excl
Re: (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 w
Re: (Score:1)
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.
Re: (Score:2)
I had no idea about rattle. It looks very useful; thanks for the info.
thanks R...(and thank you LaTex) (Score:1)
The = vs. == typo problem solution (Score:2)
The <- approach is interesting, but what's the R notation for "less than negative six".
And so, the quest continues. Pascal's := might be the best; although I hate to admit it because Pascal
is my "had to deal with in school and was struggling so I hate it"
language.
Re: (Score:2)
Re: (Score:2)
It's for 'Statistical' computing (Score:2)
Serious question here.
I do a lot of statistical analyses, including some I've authored. The book is for the programmer, but R is for statistics and that means someone who actually uses the numbers for something.
SAS has it's own language as well as GUI with menus and can interchange data structures with many common programs.
SPSS has all these, plus is can record what's pulled down from the menus and generate code in its own language, which is easy to understand, comes as a text file, and can be edited and cu
Re: (Score:1)
2. R is far more extensible than SAS or SPSS. When what you're modelling doesn't fit in with the predefined options, you can deal with that by extending R in whatever way you wish.
Those are the major advantages of R for statisticians.
Re: (Score:2)
I have used two programs for Statistical Analysis that have one advantage of R: both are free, nad part of the GNU project. Of course, both have disadvantages.
1) PSPP [gnu.org] - a free alternative to SPSS. It does not have every option as SPSS, but in my opinion is fairly complete and has a lot of power. It is just like "click click. There is the average, the median, the standard deviaton, my null hypothesis cannot be rejected, let`s go back to work".
2) Gretl - Gnu Regression, Econometrics and Time-series Libra [sourceforge.net]
Re: (Score:2)
R is growing faster and is used much more by serious statisticians to implement new ideas.
I definitely agree with you there. It's easy for them to get their ideas into motion with R, since it's open.
That doesn't necessarily make it better for most people, though. That makes it better for statisticians. Most users of statistics don't need to be on the cutting-edge. In fact, they might need to lag a bit, because peer-reviewers may not accept your paper if they don't actually understand it. I work a lot with IRT, and when I write a paper, I basically have a big chunk of boilerplate I paste in to
Re: (Score:2)
I use R from time to time. It's great for banging out a quick-and-dirty graph or something. It's so straightforward that if you really know exactly what it is you want to do, it's really fast to do it in R.
However...
I don't think I'll be using it that much now that I was able to get SPSS with the Advanced Stats pack onto my research budget. I'd been using a cracked copy of 11.5 for years, and that's why I had migrated to R. Now that I have SPSS, and didn't have to pay for it... I guess I don't really s
Re: (Score:3, Insightful)
Re: (Score:2)
Thank you all for your comments, I've learned a lot, including the fact that others use the more mundane commercial programs to good advantage too.
The best comment was u38cq's "SPSS and SAS are, mostly, for solved problems. R is for unsolved problems." Certainly most analyses that use such as T-tests (don't sniff -- it's what we do for fMRI. but on a massive scale) and ANOVA/MANOVA are more easily done with something made to do them rather than write code for such simple things. But it's not the problems th
mmm, R! (Score:2)
R is a very impressive, mature program that does a hell of a job.
I best liked connecting R data sets to a PostgreSQL database
for my PhD thesis, and then doing statistical data on SQL selections
without bothing about the SQL bits any more.
Also, I see lots of universities in Germany step up and teach R, which I think is good.
- Hubert