Chapter 29 R Learning Books
Below is a list of R resources for particular needs. Each one is excellent and will serve you well, However, each one has its limits, such as relying on base R graphics rather than ggplot2, throwing in complex coding into otherwise beginner material, etc. Find something that works for you, if you get stuck take a break or move to the next chapter, and find folks who you can ask questions. Twitter is very welcoming to people who post with the #rstats. I’ll often answer questions about R from complete strangers on Twitter or even via email. If you can find a coding Chapterner starting from a similar place that’s even better.
A note on choosing a resource for learning R: People who want to learn R come from a wide range of backgrounds and have a wide range of goal. Many resources have names like “How to learn R for xxxx” but don’t specify up front what the author assumes the reader already knows. In my list below I try to add information about what factors might contribute to whether a resource might be good for you.
Factors that are relevant to choosing where to start “learning R” include 1. How much statistics training have you had? There are many resources that start from the basics (mean, standard deviation, t-test), while others dive into more complex models without much warm up. 1. How much programming have you had? Everything in R is done using code, which can be a huge change for many folks who have used excel or point-and-click programs. 1. What kind of data have you worked with in the past? Some resources focus on working with data that is nice and tidy in a spread-sheet like format, while others get into the weeds on how to take messy data and get it ready for analysis.
In general, most books and major R resources adopt a single approach to R coding and stick with it. It’s therefore useful to shop around a bit to find a resource that works for you and then work through an entire book or resource. It’s definitely possible to learn R by googling each step you take, but as noted above you’ll see lots of different ways to approach the same problem. Starting with a single resource and getting familiar with it will help you build a foundation of skills to build from. Be aware that as you branch out you’ll quickly encounter new approaches that look unfamiliar.
29.1 Learning R for Bioinformatics
A good book for learning R for basic bioinformatics is Coghlan’s “A little book of R for bioinformatics” https://a-little-book-of-r-for-bioinformatics.readthedocs.io/en/latest/ (FREE! beginner to intermediate)
This is a pretty gentle introduction, though there are a fair number of deeper chunks of code that you need to use to do all the exercises. Someone just starting with R should be able to learn a lot from this book. The book is a bit dated - several things she writes her own code for now are done in packages. The rentrez packages is one that replaces some of her code or updates older packages she uses. I have written updates for several chapters using rentrez and can provide the code upon request.
29.2 Learning R for Statistics
Danielle Navarro is a psychologist whose book “Learning Statistics with R” is an excellent introduction to both R and statistics and assumes no prior experience with either. Chapters of book use a package written by Navvaro that is now a bit dated, and it also uses base R graphics instead of ggplot2, but otherwise, this is probably one of the best R resources out there. When I taught undergrad biostats I wish I had known about this book.
https://learningstatisticswithr.com/
https://learningstatisticswithr.com/book/
(FREE! R: beginner; Statistics: beginner to intermediate)
29.3 Learning how to load data into R
https://brouwern.github.io/BOOK_R_Ecological_Data_Science/ This is a workbook I’ve started writing. What’s currently available online most relates getting data loaded into R, which can often be one of the most difficult tasks to learn how to do correctly. It also has some material on. (FREE!. R: beginner)
Learning R for Statistics ($60. 4.5/5 stars on Amazon. R: beginner. Statistics: beginner to intermediate)
“Discovering Statistics Using R”
Andy Field is a psychologist whose statistics books are oriented towards undergraduates with no programming experience and minimal stats. I have not looked at his books extensively but they generally get excellent reviews, though people frequently note the very juvenile/irreverent humor he uses. For example, one Amazon review noted “Writing is often bizarrely risqué; seems every chapter has multiple references to male sexual function”. People also note how verbose the book is - some complain that the anecdotes, stories, and potty humor distract from the material being taught. Other folks say that the filler material makes that math and stats easier to understand and get through.
https://www.amazon.com/Discovering-Statistics-Using-Andy-Field/dp/1446200469/ref=sr_1_1?dchild=1&keywords=andy+fields+R&qid=1592242936&sr=8-1
29.4 Resources for those with some background in statistics, data analysis or programming
29.4.1 Learning R for Ecological Statistics
“Getting Started with R: An Introduction for Biologists 2nd.” ($35. 4.8/5 stars on Amazon. R: beginner. Statistics: intermediate) This is a short but excellent guide to using R which is accessible to anyone but oriented towards ecologists. The 2nd edition was re-written to use ggplot and the tidyverse. https://www.amazon.com/Getting-Started-R-Introduction-Biologists/dp/0198787847/ref=sr_1_5?dchild=1&keywords=R+statistics+biology&qid=1592243477&sr=8-5
29.4.2 Learning R for general “data science”
“R for data science” (R4DS) (Free. R: beginner-intermediate. Statistics: intermediate. Programming: Beginner-intermeidate) https://r4ds.had.co.nz/ This is a super popular text written by the most prominent R programmer, Hadely Wickham. Wickham created ggplot2 and dplyr and is the mastermide behind the tidyverse. R4DS teaches how to use these tools and Wickham’s general philosophy for data analysis. The book is not necessarily appropriate for total beginners because it moves pretty fast. It assumes the reader has worked with relatively complex data and done some intermediate statistics and now wants to do this in R.
29.5 Resources for those interested in programming
29.5.1 Learning R for programming/modeling
“A Primer of Ecology With R” (Free/$60. 4.5/5 stars amazon. R: intermediate. Programming: Intermediate Ecology: Intermediate-advanced) This is the book I learned to program with. It does not explicitly set out to teach all the finer points of programming but contains examples of all major R programming structures (e.g. vectors, matrices, loops, functions, etc). If you have a background in programming then this book will help you translate your skills to R. If you don’t know any programming but are willing to invest some time, you can use this book to teach yourself programming. Some chapters are available free online. The book is also available free from the Pitt library.
29.5.2 Learning R for programming
The Art of R Programming. ($30. 4.4/5 stars Amazon. R: intermediate to advanced. Programming: intermediate.)
An excellent reference for programming. I feel this book is underrated in the R community. It has several flaws, such as some overly complex examples and mixing of beginner and complex concepts. It’s a book I still refer back to, though its coverage on some advanced topics like parallel computation is now dated. This book is probably best as a reference book for someone with solid beginner R programming skills who wants to expand into programming or someone who can program in a different language who wants to learn how R works.
29.5.3 Learning R for Epidemiological modeling
Epidemics: Models and Data Using R ($60; R:intermediate-advanced. Programming: intermediate-advanced. Epidemiology: intermediate-advanced) A book that just came out and is highly relevant to current events. If you have some background in programming or are really interested in the topic this book is an excellent resource. There is also a MOOC associated with it. https://www.amazon.com/Epidemics-Models-Data-using-Use/dp/3319974866/ref=sr_1_fkmr0_1?crid=2SC2US02IF1QK&dchild=1&keywords=otter+bjornstad&qid=1592244881&sprefix=Ottar+Bj%2Caps%2C137&sr=8-1-fkmr0