With more than 200 practical recipes, this book helps you perform data analysis with R quickly and efficiently. The R language provides everything you need to do statistical work, but its structure can be difficult to master. This collection of concise, task-oriented recipes makes you productive with R immediately, with solutions ranging from basic tasks to input and output, general statistics, graphics, and linear regression.

Each recipe addresses a specific problem, with a discussion that explains the solution and offers insight into how it works. If you’re a beginner, R Cookbook will help get you started. If you’re an experienced data programmer, it will jog your memory and expand your horizons. You’ll get the job done faster and learn more about R in the process.

"Wonderfully readable, R Cookbook serves not only as a solutions manual of sorts, but as a truly enjoyable way to explore the R language—one practical example at a time."—Jeffrey Ryan, software consultant and R package author

Paul Teetor

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.

The animal on the cover of R Cookbook is a harpyeagle (Harpia harpyja). One of the fifty species ofeagle in the world, the harpy eagle is native to the tropical rain forestsof Central and South America, and prefers to nest in the upper canopy layerthereof. Both its genus and species names refer to the harpies of ancientGreek mythology—vicious creatures with the face of a woman and the body ofan eagle or vulture.On average, harpy eagles weigh about 18 lbs., are 36 to 40 incheslong, and have a wingspan of 6 to 7 feet, though females are consistentlylarger than males. The plumage of both sexes is identical, however: slateblack feathers dominate the animal’s top half, while the underside is whiteor light gray. Light gray-colored heads are accentuated with a double crestof large feathers, which specimens can raise when showing hostility.Harpy eagles are monogamous, and pairs raise only one chick every twoto three years. Females will usually lay two eggs at a time, and after thefirst hatches, the other is neglected and does not hatch. Though the chickwill fledge within 6 months, both parents continue to care for and feed thechick for at least a year. Because of this low rate of population growth,the harpy eagle is particularly susceptible to encroachments on its habitatand losses from human hunting. Throughout its range, the animal’sconservation status ranges from threatened to critically endangered.

The statistical programming language R can be quite overwhelming for newcomers. There seems to be so many different ways of accomplish common tasks. Before you can start doing any kind of data analysis, you need to get data into R. In addition, once the data is available you might need to manipulate it to get it into the right form. All such basic and common tasks can be difficult in a new programming language. The R Cookbook is a wonderful resource for helping out with such issues.

For anything besides most basic calculations, you need some data. The cookbook contains many recipes for reading data from various source files like CSV and HTML to more advanced stuff like fetching data from databases. Once you have the data in R you need to store and manipulate it in different data structures according to your needs. This is also covered. All recipes are organized in different themes making them easy to find. Please pay special attention to chapter 12 with useful tricks, which really do contain a number of quite useable tips.

Do NOT buy this book if are looking for an introduction to statistics. The R Cookbook assumes knowledge of various basic statistic methods and algorithms and will only show you how to apply these methods and algorithms in R. If your focus is on learning various plotting techniques then the R Graphics Cookbook also from O`Reilly might be more appropriate.

I review for the O`Reilly Reader Review Program and I want to be transparent about my reviews so you should know that I received a free copy of this eBook in exchange of my review.

I bought this book with the hope this book can explain the function explicitly and thoroughly. This is not for you.

For example, in page 154, attach(suburbs) .... this can't be accomplished because the author never told in the book how to get the data!!!

I tried searching for the data that the book referred, but nothing found!!

Compared to R graphics cookbook by Chang, This book is inferior to that book in every dimension. In R graphics cookbook, Chang starts by telling reader to install package "ggplot2 and cookbook". So, no problem for reader to catch up.

Trust me, do not buy this trash. Everything this book mention is free on internet and easy to get data to mimic.

I took a course in data mining and found that this book was my most valuable resource with the exception of "R in a Nutshell". I really liked the explanations and the examples. I downgraded my rating because this book unlike most O'Reilly programming books does not provide code for the examples. I wanted to run the examples 12.12 and 12.13 which describe sorting syntax. It was a pain that these examples could not be provided. It seems that some O'reilly books now are requiring purchasers of the book to also buy Safari access as well. Guess, it's just business. My usage did not focus on statistics but on manipulation of files. There are lots of other sections that treat those topics as well.

This is a book about how to use the R programming language to solve several statistical problems like combinations, probabilities, frequencies, quantiles, means, correlations, regressions and ANOVA analysis, and as a plus, time series analysis. This cookbook is perfect to students and professors looking for a computing tool that helps them to understand and teach statistical courses, respectively. That's because many times it is important to solve complex exercises that shows the several applications that a statistical topic, like the normal distribution, has in surveys, engineering, manufacturing and commerce, which implies performing several activities related to data retrieval, storage, processing, analysis and visualization.

This cookbook explains the how-to of such activities providing a catalog of tasks to accomplish each of these, for example, how to read and write CVS files, prepare the data contained in those files, generate random samples, calculate the probability of X, test for normality, perform linear regressions and plot the histogram. Each task is described following this structure: Problem, Solution, Discussion and See Also, being the Discussion section the valuable resource of the R Cookbook, because this section explains the implications of using the given solution together with some tips and tricks. Those implications, tips and tricks makes the difference between the R Cookbook and a raw Internet search, so students and professors can learn about the rationale of a solving a statistical problem with R, not just the syntax of variables and functions.

However, it is important to clarify that the R Cookbook is not a book for learning the essence of statistics; instead the R Cookbook is a suggested companion resource for the course main textbook. The R Cookbook will help the explanation and understanding of the core topics, exercises and applications, and simulate different problem scenarios.

Finally and personally, I'd like to see a second edition, volume or update to include how to solve operations research problems using R, if possible. For instance, simplex method, duality, transport and network problems, and inventory and queuing systems are the most common ones in operations research.

Note: This review is in exchange of the O'Reilly Bloggers Review Program (oreilly.com/bloggers).

I'm in the process of porting the statistics projects I assign to my students over to R. This book has made the process almost effortless. The book is organized wisely and the explanations and code are easily understood. Separated into chapters based on the kinds of things that can be done with R, this book helps you quickly get the job done you need to do. Both input and output are clearly shown, with a brief explanation based on the statistics behind it all.

I think it's especially useful to students who've been given a statistical analysis to do and who can use the book to figure out how to do that analysis in R. The book shares one of the reasons for using R;i.e., the ability to further explore the data by building on what we learn from previous analyses of the data. Both R and this book make it very easy to say things like, "If you split the data by gender, can you see any significant differences based on gender?"

I'd quibble a little with his explanation of the confidence interval for the mean. On p. 197 he obtains a confidence interval and says there is a 95% probability that the mean is in that interval, which I think is not quite right. Either the mean is in there or it's not! However, if we found the confidence interval 100 times using the t.test, then the mean would be in about 95 of those intervals,which I think is saying things slightly differently.

The R Cook­book by Paul Tee­tor is a solid addi­tion to the well respec­ted series. Tee­tor provides a rich col­lec­tion of use­ful examples writ­ten in the proven method and cov­er­ing everything from installing, con­fig­ur­ing and run­ning R to car­ry­ing out soph­ist­ic­ated stat­ist­ical ana­lysis tasks that demon­strate the power of R. The book is tar­geted at a wide audi­ence from R novice eager to just start play­ing in R to more exper­i­enced prac­ti­tion­ers look­ing to hone and round out their R rep­er­toire. It can be used as an intro­duct­ory train­ing source for those who like to learn by doing and extra­pol­at­ing know­ledge from examples. It also has the use­ful abil­ity of func­tion as a ref­er­ence source when plot­ting a par­tic­u­lar R exercise.The prob­lem — solu­tion — dis­cus­sion pat­tern works well when the prob­lem is clearly and con­cisely stated as Tee­tor does. As the book pro­gresses it does move towards more advanced stat­ist­ical manip­u­la­tion and ana­lysis, but then if you are using R in the first place then this is a fairly safe assump­tion. This is one of the more not­able cook­book series for the thor­ough­ness of the dis­cus­sion. The inclu­sion of philo­soph­ical notes, para­meter and options sec­tions when neces­sary and finally the cross-indexing via the more inform­a­tion sec­tion set this book apart as a superb ref­er­ence. In con­junc­tion with the R in a Nut­shell which was reviewed earlier, there are indis­pens­able tools for the bud­ding R enthu­si­ast and in con­junc­tion with the freely access­ible R ref­er­ence manu­als from the Found­a­tion form the optimal R lib­rary.My only gripe is that there is less focus in this book on the visu­al­isa­tion end of R. That is not to say that there not vis exer­cises in the book. Simply that it is heav­ier on the ana­lysis end on the lan­guage which is actu­ally well and good as this is cru­cial to the lat­ter and an area that I for one need the instruc­tion.This cook­book does not expect read­ers to arrive with extens­ive R know­ledge and as I men­tioned earlier is tar­geted for a broad audi­ence of R practitioners.

Paul Teetor finally brings R to the masses! I've struggled for several months now to learn R on my own from a non-statistical background. I've struggled through several other books on R, but they never read as easily as Teetor's R Cookbook does. Coupled with O'Reilly's R in a Nutshell, if you have Teetor's R Cookbook on your bookshelf, too, R becomes a practical, useful, software tool you can become comfortable with.... even with R's steep learning curve. Teetor knocks the learning curve down to size!Hint: 2nd edition needs more Time Series discussion!

Simply put, one of the best R starters around. What you get here are recipes for most common problems you will face while working with R. This book is an extended version of 25 Recipes for Getting Started with R. However, the coverage of material is different. While 25 Recipes focus on getting started with R, R Cookbook penetrates the subject in greater details and goes beyond simple usage of R. You will find here not only how to load data, manipulate it and plot some graphic. You can find description of various statistical analysis as well.

This book, is not for a reading in bed just before you go to sleep. It is too pragmatic. Simple definition of the problem and just after that, simple solution – that's what you get when it comes to each issue covered within the book. This is the strength of R Cookbook. On the other hand, it's weakness. If you cant find the question within table of contents it might be hard to get the answer for what you ask about. As I like pragmatic approach, I like the book as well. For me it's just perfect. Well, maybe just too short.