This two-hour workshop focuses on introducing R through a worked example. The scientific goal is to perform a simple statistical analysis on a set of data using R. While working towards that goal, students will learn how to read three different types of datasets into R, check the datasets and do basic data manipulations, and graph the data. The workshop will demonstrate some common coding techniques as well as some of the pitfalls that the R beginner faces, such as working with factors and missing values.
We will spend a fair amount of time talking about R help throughout the workshop - where you can find it, how to search for it, and, in particular, how to use the documentation within R. In my experience, knowing how to work with datasets in R and knowing where to look for help can take you pretty far into the world of R.
I provide an R script that we’ll run code from during the workshop as well as a PDF document. The PDF is a written version of the workshop, including code and output, to be used as a reference. Make sure you save the R script as a file ending in
.R and not as a text document. You may need to set it to “All Files” and manually add
.R when saving.
In addition to the materials above, I have converted the workshop material into four interactive tutorials. This goes through the information given in the PDF in smaller pieces while you can code interactively.
The four tutorials are designed to be done in order, but this is not strictly necessary. Here are the topics covered in the entire workshop series:
You have the option to do the first three tutorials online via your browser.
If you already know a little bit about using R via RStudio, all four tutorials can be run on your own computer. To do this you will need to have package learnr installed (
Click on a tutorial listed below and save the file as a .Rmd when the download window opens. Open this saved Rmd file with RStudio and click the
Run Document button at the top to start the tutorial.