R mini-course at NORC, Academic Research Centers
welcome!
You can download the course materials for each week from this page. Below the course materials, I've posted some extremely helpful cheatsheets (the zipped version contains a few that aren't listed individually). There's also a list of links to other useful online resources for learning R, including videos, interactive lessons, interesting blog posts, tutorials, articles, etc.
week 1: R programming + workflow fundamentals
week 2: working with data
week 3: plotting/vizualizing data
and working with the web no time! :/
week 4: R Markdown cheatsheets
Here's a handful of nice cheatsheets for various aspects of the R and R Studio ecosystem.
- R Studio IDE cheatsheet -- quick reference for common stuff in R Studio, also a bit on keyboard shortcuts (by R Studio)
- base R cheatsheet -- the very basics of many frequent topics (by Mhairi McNeill)
- data import cheatsheet -- for reading in data from various formats/filetypes (by R Studio)
-
data wrangling cheatsheet -- this is probably the most important one. uses
dplyr::
workflow (by R Studio) -
data vizualization cheatsheet -- very useful for helping make plots, but requires some knowledge of how
ggplot2::
works (by R Studio) - R Markdown cheatsheet -- most of what you'll need to make nice pretty documents very easily! (by R Studio)
links to stuff
Here's a collection of useful or interesting links related to this course and scientific computing in general. If you find something cool, send it to me and I'll put it up! (if I think it's well-written and makes sense for the course trajectory)
online resources for learning R via using R
-
R-Fiddle! -- a web-based R interpreter that you can (and should!) use to practice. this can be an extremely useful resource for practicing. some things to know:
- there's no configuration or setup, just a live R session running in the cloud
- here's a quick example I made, which you can edit and mess around with: [iris plotting R-Fiddle session]
- hit the question mark at the top right for a quick tour
- you can type directly into the console, or use the script editor (seems like "run code" runs the entire script, so in order to run things line-by-line just copy them into the console)
- good way to practice making plots (supports base and
ggplot2::
graphics) - you can even right-click on a plot you made to save it!
- you can share code easily by hitting save in the top-ish left, then copy the url you get from share. A truly excellent and under-utilized way to share quick code snippets.
- if you want to play with a dataset, read it in with its original url (or put it in your dropbox and then generate a public link and use that)
- beware: you can load some but not all packages. better not to try installing them -- just use the available ones. (R-fiddle isn't meant to replace R Studio)
- beware: if you get stuck or the interpreter won't stop running, hard-reset the page (cmd+shift+R on mac; ctrl+shift+R on windows)
-
DataCamp's directory of R courses -- DataCamp has tons of great resources. The interactive browser-based interface is really excellent -- it's a mix of videos, text, slides, and exercises, all of which you can access without ever leaving the site. There's tons of courses and several difficulty-levels, so browse around to find one you're interested in.
-
some google dev intro to R video clips -- these are really excellent. The first week's materials of this course were loosely based on the format of these. even though we have or will cover pretty much everything in these, it's still valuable to watch them to reinforce the concepts. Note that you'll also see the default R GUI, which is a lighter-weight interface compared to R Studio.
blog posts illustrating data analysis with R
Some of these are written with a beginner audience in mind, but some of them are decidedly not. If there's one that sounds interesting but the code/narrative is opaque at this point, try coming back to it after a couple of months of practice -- you'll be able to understand more than you did the first time.
-
analysis of Trump's tweets, in R -- this post made the news rounds last year. it's great. you should read the whole thing. Robinson uses
dplyr::
pipe-chains just like we'll start doing in week 3. You should browse this whole blog, it's full of great stuff. -
text mining and sentiment analysis with R -- another classic from David Robinson (not this David Robinson aka the Admiral). Has links for background near the top, too.
-
solution to a 538 puzzle using R -- illustrates a nicely-implemented simulation, created as a response to a 538 "riddler" puzzle.
-
a nice blog post on the concept of vectorization in R. if you can understand what's going on in this post by the end of the course, you'll be further along in your R journey than you might think. warning: the author uses
=
for assignment instead of<-
. this can be dangerous and is not recommended, but you'll see it sometimes, for a couple of reasons: (i) across programming languages,=
is probably the most common assignment operator; and (ii) in R, you can get away with using it for assignment in some contexts (but not all). -
comparing ggplot2 and base graphics -- very nice blog post from Nathan Yau. check out his site flowingdata.com for all kinds of cool, interesting, and/or fun content.
videos (various topics related to R and programming)
-
a bunch of freely available webinars released by R Studio -- they cover a number of topics and tend to be of extremely high quality.
-
R Studio tips and tricks video
-
Hadley Wickham lecture -- on doing data science in R; also contains nice motivation for the tidyverse (aka "hadleyverse" by the R community)
-
very recent (may 2017) Andrew Gelman talk -- "Theoretical Statistics is the Theory of Applied Statistics: How to Think About What We Do"
-
nice Jenny Bryan plotcon talk on
purrr::
, and on using data frames as containers for disparate objects (advanced but useful if you continue working in R) -
"how the internet works in 25 minutes" -- nice talk by Jenna Zeigen video and slides
-
entertaining talk that i'd characterize as belonging to the genre of "the psychology of programming" video here and slides here. related ones: here/here