By Julie Lowndes | December 17, 2018
updated with R for Excel Users resource Apr 2020
So you want to learn R
So you want to learn R, where do you start? There are a lot of written and video tutorials and books and blogs online, but how do you navigate them? Our Ocean Health Index team put together a list of the resources we used to learn R that helped our team’s path to better science in less time. But this might still not be helpful for where you should actually start.
Here is my advice. This is going to be a very opinionated path to learning R, and it is by no means the only path forward. But it is the result of having gone through the learning process myself and having taught these practices for over five years. I am going to share from my experience, and only suggest freely available resources. There are also courses you can pay for, and they can be great! But we’ll stay with the freely available resources.
A few things before we talk about specifics:
- Be hands-on. Whatever tutorials or courses you use, you should expect to install software on your computer and be typing along with the lesson.
- I would highly recommend (as would Jamie Afflerbach, co-founder and lead of Eco-Data-Science), that you come motivated by a project that you have or that you develop very soon. Have some data and a question. It can be looking at trends in six months of credit card statements, or data from your labmate. But if you have a question you’ll be able to put your skills to practice as you learn them.
- Learn with community. Learning to code takes time, and it is more fun with friends. You will need to put in hours on your own to learn, which is what this post is about. But do not have that be your full experience. Here are tips for how to start a coding club.
Start learning R with GitHub
Coding is collaborative. You will want to share code with others — starting with yourself. Emailing code can be very problematic, because it involves keeping all of the code files and data files organized and in the right place. Better to use something like GitHub, which is collaborative version control. This adds more things to learn up front, but the payoff is substantial.
If you want to learn R and GitHub together, I would recommend starting with R for Excel Users (Lowndes & Horst 2020) that we developed for the 2020 RStudio Conference (similar resource is the Ocean Health Index’s Intro to Open Data Science, which the OHI team developed and has been teaching from for years and has recordings).
R for Excel Users has lessons for a 2-day course, broken into 1.5-hour sessions. It starts with how to install all the software you will need for the course, and then each chapter builds from the previous, so that you practice your skills together as a workflow.
I would also recommend watching the RStudio webinar called “Advanced Data Science: Collaboration and time travel — version control with git, github, and RStudio” (navigate there from the Learning Roadmap).
Note: If you want to learn R without GitHub at this point, you can still use this book to do it by skipping the GitHub parts.
Learn R for data analysis in more depth and breadth
R for Data Science is hands-down the best book for learning R for data analysis. RStudio folks like Hadley Wickham and Garrett Grolemund are actually the ones developing ways to work efficiently and effectively in R, and to learn directly from them will also give a good sense of the theory and deliberate practices. This book is used to teach university courses and will continue to be your go-to reference for R.
Continue with other tutorials from list of the resources, including listening to podcasts, and learning how to build websites and books!
Photo by Elliot Lowndes