R Cookbook: Proven Recipes for Data Analysis, Statistics, and Graphics 2nd Edition
Use the Amazon App to scan ISBNs and compare prices.
Frequently bought together
From the Publisher
From the Introduction
Welcome to the R Cookbook, 2nd Edition
R is a powerful tool for statistics, graphics, and statistical programming. It is used by tens of thousands of people daily to perform serious statistical analyses. It is a free, open source system whose implementation is the collective accomplishment of many intelligent, hard-working people. There are more than 10,000 available add-on packages, and R is a serious rival to all commercial statistical packages.
But R can be frustrating. It’s not obvious how to accomplish many tasks, even simple ones. The simple tasks are easy once you know how, yet figuring out that “how” can be maddening.
This book is full of how-to recipes, each of which solves a specific problem. Each recipe includes a quick introduction to the solution followed by a discussion that aims to unpack the solution and give you some insight into how it works. We know these recipes are useful and we know they work, because we use them ourselves.
The range of recipes is broad. It starts with basic tasks before moving on to input and output, general statistics, graphics, and linear regression. Any significant work with R will involve most or all of these areas.
If you are a beginner, then this book will get you started faster. If you are an intermediate user, this book will be useful for expanding your horizons and jogging your memory (“How do I do that Kolmogorov–Smirnov test again?”).
The book is not a tutorial on R, although you will learn something by studying the recipes. It is not a reference manual, but it does contain a lot of useful information. It is not a book on programming in R, although many recipes are useful inside R scripts.
Finally, this book is not an introduction to statistics. Many recipes assume that you are familiar with the underlying statistical procedure, if any, and just want to know how it’s done in R.
Most recipes use one or two R functions to solve a specific problem. It’s important to remember that we do not describe the functions in detail; rather, we describe just enough to solve the immediate problem. Nearly every such function has additional capabilities beyond those described here, and some have amazing capabilities.
We strongly urge you to read the functions’ help pages. You'll likely learn something valuable.
Each recipe presents one way to solve a particular problem. Of course, there are likely several reasonable solutions to each problem. When we knew of multiple solutions, we generally selected the simplest one. For any given task, you can probably discover several alternative solutions yourself. This is a cookbook, not a bible.
In particular, R has literally thousands of downloadable add-on packages, many of which implement alternative algorithms and statistical methods. This book concentrates on the core functionality available through the basic distribution combined with several important packages known collectively as the tidyverse.
About the Author
J.D. Long is a misplaced southern agricultural economist currently working for Renaissance Re in New York City. J.D. is an avid user of Python, R, AWS and colorful metaphors, and is a frequent presenter at R conferences as well as the founder of the Chicago R User Group. He lives in Jersey City, NJ with his wife, a recovering trial lawyer, and his 11-year-old circuit bending daughter.
Paul Teetor is a quantitative developer with Masters degrees in statistics and computer science. He specializes in analytics and software engineering for investment management, securities trading, and risk management. He works with hedge funds, market makers, and portfolio managers in the greater Chicago area.
- Publisher : O'Reilly Media; 2nd edition (July 16, 2019)
- Language : English
- Paperback : 600 pages
- ISBN-10 : 1492040681
- ISBN-13 : 978-1492040682
- Item Weight : 2.08 pounds
- Dimensions : 7 x 1.21 x 9.19 inches
- Best Sellers Rank: #310,481 in Books (See Top 100 in Books)
- Customer Reviews:
About the author
Reviews with images
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
There is no mention of the powerful datatable package, which, to me., is the most important recent development since purrr, dplyr, and of course, the tidyverse. R programing with datatable offers a quantum jump in efficiency. The datatable package long predates the release of this book.
For this reason alone, I would recommend waiting for the next update.
These are page flippers – doesn’t that look marvelous, we’ll have to try it next time we find halibut cheeks. The sad fact, though, is that any of these books are lucky if the owner actually uses one or two of its recipes and exalted if a recipe becomes a dinner party staple.
The first edition of R Cookbook by Paul Teetor, published in 2011, was, in analogy, similar in that it provided flavors with good recipes, many of which proved useful for specific needs.
The second edition, just out with J.D. Long as co-author retraces and updates much of the content of the first edition, brings RStudio and tidy tools to bear, and subverts the dominant paradigm. You flip through it and it first appears to be the cookbook equivalent of granny’s index card recipe box. But it starts off with enough new that you stop flipping pages and start reading.
It took me two days to read the 554 pages. I had the help of several airplane hours, but it would have been a page turner anyway. What captivates is the rigorous R tutorial cleverly hidden in asides, call-out boxes and brief explanations of why a particular code chunk does one thing when you might reasonably expect another.
In my childhood, Donald Duck had three nephews, Huey, Dewey and Louie who got their uncle out of more than one jam by consulting The Junior Woodchuck Manual, which somehow contained the answer to any question that could possibly arise. The R Cookbook, 2ND Ed. comes close to that standard for the beginner to intermediate user who is completely innocent, on the one hand, or who has been covertly using functions without a well-founded understanding of their requirements and limitations.
It would be an unconventional choice, perhaps, but this is the book that I would choose for the text if I were teaching a course in introductory R. Why? Because this book tells you what R does, not what it is. Any student coming to it with even an imprecise notion of f(x) = y is going to be able to follow along to the point, perhaps, of wanting to write her own package. The text doesn’t cover this, but points you in the right direction, and suggests source(“good_stuff.R”) as an interim step.
In other words, its approach is like R’s, functional, not imperative, definitional not procedural. In my view, the implications in the R vs. Python wars are obvious. In one model, Professor Higgens tells Eliza bring me my slippers. In the other, he first has to declare a subject (the slippers), a possessive (my slippers), object (grammatical, me) and then, with the verb, provide detailed instructions on where they are to be found, how brought into possession and the means by which they are to be transported to their destination.
Someone once said something to the effect that assembly language uses humans as pre-processors. I’m afraid that is true of many of its do-this, then do-that descendants.
For now, their defense is the superiority of compiled programs in speed on the metal and the much more expensive wetware. And they are right for the one-off case. But as cases proliferate or become abstracted, wetware costs go up faster than throughput advantages.
It will not happen while I’m still sentient enough to follow, but a compiled R or an R to Haskell API does seem to provide the best of both worlds. Put the wetware where it belongs, in defining the problem and the appropriate solution and leave the optimization to languages that are good at implementing functional logic.
Top reviews from other countries
Reading throughout the entire book will give you a very good idea of what R can do and *how* R does it, so you will no longer need to hop from one site to the other every time you decide to write a script (maybe just once in a while for some more advanced cases).
10/10 would buy again.