Learning R
The distinctive thing about the Survivor’s Guide is that it focuses on learning R rather than on learning statistics. It is organized thematically around the things you need to learn to do R effectively, rather than around statistics with the R lessons scattered about. Where most introductory R books are about statistics, with an appendix on R, this book is about R with an appendix on statistics. Ultimately, of course, it is the statistics and the data that really matter. R is just a tool for those more important processes. But, without a good handle on this tool effective and efficient statistical analysis will remain out of reach.
The Survivor’s Guide is also distinguished by its more narrative approach. I’ll talk you through most of the processes and procedures you’ll need to gain a basic facility with R. Following along with the many examples will get you a long way. All of the R code from the book is available here so that you can cut and paste. That is a fine way to get started. Eventually, though, you have to move from rote learning to internalizing R’s basic principles and practices.
The learning curve for R is steep. I have tried to make it as painless as possible, but as with learning a foreign language, there is only so much you can learn from a book. Sooner, rather than later, you’ve got to get immersed in your own projects where you will encounter new challenges. It is in working through those challenges that you actually really internalize the basic nature of R.
The Survivor’s Guide can be thought of in four pieces:
The R Basics. Chapters One and Three through Seven provide the critical foundation for everything else in R. How to get your data into R (Chapter 4). How to sort and select your data (Chapter 6). How to do basic data transformations (Chapter 7).
Chapter Three may be the most critical of the book. Coming to grip with R object types is absolutely essential. In my experience, this is the number one thing that trips up new and even not-so-new users. Whenever you get an error the first thing you should check is whether you have the code right–the niggling details about spelling, capitalization, commas, parentheses, and quotation marks. But the second thing is your object types. You have to know whether the function you are trying to use works on vectors or dataframes and whether it has problems with factor or character variables. At the same time, you have to know exactly what kind of object R thinks you are working with.
Statistics with R.Chapter Two and Appendix II provide a brief overview of the most basic statistical functions in R. Many of the basic statistics you are likely to encounter in an introductory statistics class are set out here. Importantly, this is not a statistics book per se. The focus is on the R procedures. The Survivor’s Guide is designed as a supplement to help you get over the R hump so that you can move on to the other materials that will provide the critical conceptual understanding you need to really learn statistics.
Special Topics in R. Chapters Eight through Eleven deal with more specialized material. You’ll know if you need this stuff. Chapters Eight and Nine deal with the special demands that arise from textual data and from date and time data. Chapter Ten is about merging and aggregating data, while Chapter Eleven covers the almost inevitable challenges created by missing data. Again, this is about dealing with missing data in R operations, not about the critical statistical implications of missing data.
R Graphics. Chapters Twelve through Fifteen provide a thorough introduction to basic graphics with R. This starts with a quick tour of most of the built-in plots in R. Then Chapter Thirteen is about some of the foundational things like setting up graphics devices, working with device coordinates, and setting up multiple plots. Chapters Fourteen and Fifteen, respectively, deal with textual elements like labels, titles, axes, and legends, and with lines, colors and shapes.
Teaching R
The Survivor’s Guide is not a statistics book. It is meant to supplement the more traditional statistics materials which, of course, must focus more on the many challenges of learning statistic rather than getting caught up in the details of R. In addition to teaching the basics of working with R that will be essential for any statistics class, the focus of the Survivor’s Guide is on two critical real-world areas that often get passed over in introductory statistics classes: learning to manage and construct workable data, and producing effective graphics.
The Survivor’s Guide is written in a narrative and conversational style that should make it relatively straightforward for students to work through on their own. Once they have a handle on the basic R foundations presented in the first few chapters, and which are likely to be reinforced by other statistics books and by the demands of early assignments, they will find the more specialized elements and the extensive graphics help more useful as they move on to develop their own projects and as they encounter situations that demand those specific skills.