In this post I’ll list and describe some of my favorite resources for learning R (R-esources?). There are already so many amazing resources for learning R scattered across the interwebs that this will likely go unnoticed. But if even one person learns something about R from my haphazard explanations and dry humor, then it would be worth it.
Before learning R, I had zero experience with any sort of coding (I never had a myspace, so I hadn’t even played around with html). When I found out I had to learn R for my stats course, I felt justifiably terrified. Luckily, the internet exists. I’ve grown fairly
competent confident in R over the years since my first graduate stats course—and a little less scared—thanks to the plethora of amazing resources freely available for R. This list will probably seem pretty basic and mundane to most R users, but maybe it would be helpful to someone just starting out.
- Google: When I first started using R, I had to google basically every little thing I wanted to do (how do I change a variable name again?). Then I had to google every error message that inevitably arose as I tried to run what I had copy/pasted from my previous google. But after a couple years of careful searching and copy/pasting and editing and carrying out my own projects in R, I still google nearly everything. Being competent in R is being good at googling (for me at least). You could stop here and just start googling and you’ll find out about all the below resources all by yourself. You don’t need me any more; be free!
Stack Overflow/Stack Exchange: I just googled the difference between these two sites, and I still couldn’t tell you what the distinctive purpose of each would be. But I know they are massively helpful communities for a broad range of topics. More often than not, when I google an R question or error message, the first link that comes up is from one of these communities. One of the most important lessons I’ve learned in my 2+ years of scanning stack overflow/exchange is that no problem in R is unique or special: someone will always have experienced it before—and most of the time, someone will have already figured out how to overcome it.
James Curley’s ‘learnR’ repository: If I suffered some sort of acute amnesia that caused me to forget how to R (but I somehow retained my stubborn desire to become an academic), I would start here. This repository has everything needed to become competent in R and even lays out a weekly plan to get through the material. It starts off with the basics and by the end of it you’ll be making your own packages and pushing them to Github (if you don’t know what Github is, maybe this course is for you!). Plus, you’ll be introduced to a bunch of other great R resources as you make your way through the materials.
R Projects and R Markdown: this last point is more of a tip than a resource. Up until a couple months ago, I spent my life chasing scripts across folders, writing painfully long file paths every time I wanted to read in a dataset, and tediously copy/pasting results into Word documents. When I found out about creating R projects and using R Markdown, I felt betrayed (WHY DIDN’T ANYONE TELL ME THIS BEFORE!?), but also relieved. Hopefully, I can save someone from this painful experience by telling you about both now. Projects allow you to keep all your scripts, data, figures, etc. organized in one place. Everytime you open the .Rproj file, it will reset your working directory to the project folder so you only have to go forward/backward a level or two when specifying files paths [e.g.,
read.csv("username/veryspecificfoldername/underspecifiedfolder/anotherfolder/generalresearchfolder/folderforproject/folderwheremydatais/cleaneddata/usethisdata.csv")]1. In addition to being unaware of the benefits of projects, I was unaware of R Markdown. R Markdown lets you create beautiful reproducible reports—where you can see the code along with the output—in addition to a bunch of other cool stuff, like making presentation slides and websites (like this one I made!). Anyway, I’m still learning to use these tools, but as with all things R, an abundance of documentation and help is available online; praise Google!
So those are some of my favourite R-esources. I hope this short list could be useful to someone at some point.
If you’re reading this, you’re probably thinking to yourself “Why would you do that?”. I wouldn’t have an answer for you, except “I didn’t know any better.”↩