Introduction to R

04 Jan 2018 » James Diao » New Haven, CT

Over the past few years, R has become my programming language of choice. Why? Mostly habit. I like that it has built-in vectorization, a huge and comprehensive suite of packages, a beautiful IDE, and tons of StackOverflow support. It’s also free and open-source! But there are good reasons why most “real” programmers hate it. It can be annoying to specify memory allocation and control, and it is super slow if used improperly.

Still, R is great for scripting and statistical analysis, and it’s especially popular in research and bioinformatics. Here’s a quick guide for those interested in learning more:

Cheat Sheets

The RStudio Cheat Sheets are definitely not intended to help you learn from the ground up, but might be helpful for those who want to patch up their knowledge of important functions and practices. I’ve included the (in my view) most useful sheets, but RStudio’s webpage contains many more, including sparklyr for big data analysis, survminer for survival plots, and quanteda for text analysis.

Tutorial: Harvard Institute for Quantitative Social Science

Harvard IQSS has super easy introductions to basic programming, graphics, and statistical analysis in R, Python, SAS, and STATA. The links to R-relevant tutorials are given below. Related code, datasets, and images are found here. I recommend that you open up the .Rmd file and follow along the .html file, writing and executing your own code as you go.

Tutorial: A Compendium of Clean Graphs in R

Although packages like plotly and ggplot2 have come to dominate R graphics, plotting in base R can be quite effective and visually appealing. In this tutorial, Eric-Jan Wagenmakers and Quentin F. Gronau explain and demonstrate some best practices for base plotting.

<< Back to Archives