Getting Started with R
By: Lydia Kajeckas
Tags: Rstudio, Data Visualization, Data Science, Tidyverse, R

The first coding language I ever learned was R. I picked it up quickly, and my knowledge of R has definitely helped me while learning python. I’ve found R and python in the way French and Italian are similar- while there are certainly differences, they have a good deal in common. In honor of the release of R version 4.0.3 (amazingly titled ‘Bunny-Wunnies Freak Out’) on Saturday, I’ve complied some of my favorite resources for R, as well as a few extra non-language specific but helpful resources. All of these resources are not only fantastic, they’re also free! I hope you find them as helpful as I do!

First up, we have R itself, which can be found at R: The R Project for Statistical Computing. In case you didn’t know, R is free, and incredibly powerful statistics and coding software. To install, go to the CRAN page, and choose the location that is closest to you. R is available for all three main systems; Mac, Windows, and Linux. R is great, but the easiest way to use it is to also get…

RStudio!

RStudio is an Integrated Development Environment, or IDE. Like R, it is free. Basically, if R is a typewriter, RStudio is a word processor. It makes life much easier; with RStudio you can edit code, run single code chunks, get alerts when your syntax is incorrect (one of the most common sources of errors), utilize packages (more on those later), and get easy access to help pages. It can be downloaded here; just choose ‘Download RStudio Desktop’. There are online versions of RStudio, but those do have an associated cost.

Photo by Donny Jiang on Unsplash

Moving on to packages! There are over 10,000 packages available for R, and I could write multiple posts. Starting off though, there are a few that are particularly helpful to showcase.

First is tidyverse. Even if you’ve never used R, you may well have heard of tidyverse. This core group of packages are ones I use on a daily basis. tidyr (for data cleaning), dplyr (for data manipulation), ggplot2 (for beautiful visualizations), hms and lubridate (for any date or time data) and more, will be your foundation starting out. This should be your first install after R and RStudio. 100/10.

Swirl is excellent, because it teaches you how to use R, in R. Once you have the package loaded and opened, you can choose from a variety of tutorials, and even download extra courses from the GitHub repository. It’s a fantastic way to familiarize yourself with R. The only caveat is that swirl runs solely in the console, and is not very RStudio Notebook friendly. I would still recommend using it in the console with RStudio, it’s just something to be aware of. If you’re just starting to learn R, you need this package.

The last two are fairly basic, but no less useful. Stats contains basic statistical functions, and datasets has datasets to play with when you’re getting started.

The book R Packages, by Hadley Wickham and Jennifer Bryan, is also helpful for finding a particular package to fit your needs, as is Google. And with that, let’s move on to books!

R for Data Science: Visualize, Model, Transform, Tidy, and Import Data, by Garrett Grolemund and Hadley Wickham

It has step by step problems, progresses in a very natural and comprehensible way, and also has additional exercises at the end of most sections. This book can teach the basics of R. A great option if you’re looking for a traditional approach- we used this book in one of my college statistics courses.

R for Data Science: Exercise Solutions, by Jeffrey B. Arnold & Contributors

The handy unofficial companion to R for Data Science, this book contains example solutions to the exercises in R for Data Science. It can be very helpful, however, something to be aware of is that some of the solutions can be overcomplicated, or use strategies that have not yet been covered if one is working through R for Data Science sequentially. Still, it’s free, and it’s a useful resource for when you’re really stumped.

Fundamentals of Data Visualization: A Primer on Making Informative and Compelling Figures, by Claus O. Wilke

The data visualization bible. It’s excellent. It does a very good job of breaking down the basics of data visualization, and focusing on the main principles, while also explaining the pros and cons of visualization. I send this book to someone at least once a week. It’s a fairly quick read, and the online version of the book is easy to search to find the exact graph or figure you want to reference. 100000/10. I would like a physical copy for my birthday.

Finally, last but not least, is TidyTuesday! TidyTuesday is a weekly data science and visualization challenge, that gives great practice in cleaning, managing, and visualizing large datasets. The past datasets are also great resources to use when you grow bored of the R datasets package, and since it’s open source, going through the code of others and looking at the approach they take to cleaning and visualizations can be very helpful.