If you are in the world of research, there is no doubt that you haven’t yet heard of R and R Studio.
These programming languages are emerging as some of the most popular tools in data science for data exploration (with graphics) and statistical computing. I’m thinking you’ve come to this page because your time to learn R is now!
Some people can be totally freaked by the idea of coding, but programs such as R help science become more transparent and actually help you to keep track of your analysis process.
Why learn R?
Having all your data processes written in code from the very first step, means if anything goes wrong at any stage, you’ll always have the script of exactly what you did.
If at some stage some sorted or edited data files go missing, you can easily re-run your code to create everything again from scratch. Compared to working with data in excel – if your spreadsheet is suddenly deleted – there’s no way you’d be able to create means, delete columns and add rows from the raw data again, simply with one keyboard shortcut.
You can also see exactly what you did at every step of your analyses. If you ever get six months down the track and wonder why a certain participants’ data looks like this and not that, you’ll likely have written exactly what transformations you did to it in your code (aka script).
Using code also helps to be open about data analysis, and sharing it can lead to more reproducible research and greater scientific integrity! Research techniques can be shared, discussed and tweaked by multiple scientists across different disciplines to produce better quality research outcomes.
For someone like me (who spent an entire undergraduate degree working with SPSS), it didn’t take long to get hooked on programming in R.
The neuroscience lab that I work in is particularly obsessed with R as a platform for statistical analyses of experiments and creating beautiful graphs for theses and scientific journal article submissions.
It’s not hard to see why!
Before you learn R: Get R and R Studio
The best part about R is that it is all free and open source. Open source refers to programs that are publicly accessible and publicly modifiable – and this also means that learning to code in R also comes with a huge community of people interested in making it more practical, useful and accessible in the widest range of contexts possible.
R is the programming language itself, while R Studio provides an interface to work with R.
R itself can be downloaded from the website here.
Free Online Resources to Learn R
Once you have R and R Studio set up on your computer, you are ready to delve into the realm of coding.
The great thing about R is that there is no shortage of free online resources to become a data science whiz.
Here are free online resources that I have used on my journey to learn R.
This one is not to be missed. It’s by far the first thing you need in your hands when beginning to learn R.
The book is entirely available online, and goes through the real basics of tidying data files, exploring, creating graphs, and touches on a few statistical models.
The coolest part is, the entire thing was also written in an extension of R (called Bookdown) and you can view the source code too to see exactly how it was produced!
If reading isn’t particularly your forte, you can also jump straight into this interactive learn to code website, where you can learn R within your browser window.
DataCamp has heaps of courses on how to learn R, as well as other programming languages like python and SQL.
While there is a paid version, you can do a few of the courses as a bit of a trial, and learn a little bit that way!
This book will take you through every aspect of ggplot (geoms, themes, scales and labelling). There is no doubt that you will become a graphing professional by the end!
When you need some datasets to play around with, look no further then the Tidy Tuesday repository on Github. If you don’t know what a repository is, its just a place to upload code online! It simply means that things can be shared around.
Tidy Tuesdays is run by the R for Data Science community – and involves weekly uploads of new datasets to be explored. You’ll get a fancy new dataset to explore, introductions on its contents and some example code as to how others have played around with it!
If you need some quick and dirty cheatsheets for R, head to their website to find lots of double-sided A4 sheets full of quickly accessible information on graphing and specific packages and functions.
These are super easy to download to your computer and have beside you anytime you might need them!
As I said before, R is a open-source program, and therefore has a huge community of people behind it, always trying to make it better and share any struggles they’ve faced.
You will be able to find heaps of resources on how to learn R by jumping on to twitter and doing a quick search! It is the after all, the preferred social media of researchers and scientists, so it’s where you’ll find lots of discussion and sharing!
This is by no means an extensive compilation of free online resources to learn R. The community of researchers on R are only a google away, so don’t be scared to delve into the world of coding.
You’ll soon find you are not the only one!