Workshop Schedule
Day 1
Time | Topic | Instructor |
---|---|---|
10:00 - 10:30 | Workshop Introduction | Will |
10:30 - 11:45 | Introduction to R and RStudio | Elizabeth |
11:45 - 12:00 | Overview of self-learning materials and homework submission | Will |
Before the next class:
I. Please study the contents and work through all the code within the following lessons:
- R Syntax and Data Structure
Click here for a preview of this lesson
In order to utilize R effectively, you will need to understand what types of data you can use in R and also how you can store data in "objects" or "variables".
This lesson will cover:
- Assigning a value to a object
- What types of information can you store in R
- What are the different objects that you can use to store data in R
- Functions and Arguments
Click here for a preview of this lesson
Functions are the basic "commands" used in R to get something done. To use functions (denoted by function_name followed by "()"), one has to enter some information within the parenthesis and optionally some arguments to change the default behavior of a function.
You can also create your own functions! When you want to perform a task or a series of tasks more than once, creating a custom function is the best way to go.
In this lesson you will explore:
- Using built-in functions
- Creating your own custom functions
- Reading in and inspecting data
Click here for a preview of this lesson
When using R, it is almost a certainty that you will have to bring data into the R environment.
In this lesson you will learn:
- Reading different types (formats) of data
- Inspecting the contents and structure of the dataset once you have read it in
II. Complete the exercises:
- Each lesson above contains exercises; please go through each of them.
- Copy over your solutions into the Google Form the day before the next class.
Questions?
- If you get stuck due to an error while runnning code in the lesson, email us
Day 2
Time | Topic | Instructor |
---|---|---|
10:00 - 10:50 | Questions about self-learning | All |
10:50 - 11:15 | In-class exercises + Answer key | Elizabeth |
11:15 - 12:00 | Data Wrangling: Subsetting Vectors and Factors | Will |
Before the next class:
I. Please study the contents and work through all the code within the following lessons:
- Packages and libraries
Click here for a preview of this lesson
Base R is incredibly powerful, but it cannot do everything. R has been built to encourage community involvement in expanding functionality. Thousands of supplemental add-ons, also called "packages" have been contributed by the community. Each package comprises of several functions that enable users to perform their desired analysis.
This lesson will cover:
- Descriptions of package repositories
- Installing a package
- Loading a package
- Accessing the documention for your installed packages and getting help
- Data wrangling: data frames, matrices and lists
Click here for a preview of this lesson
In class we covered data wrangling (extracting/subsetting) information from single-dimensional objects (vectors, factors). The next step is to learn how to wrangle data in two-dimensional objects.
This lesson will cover:
- Examining and extracting values from two-dimensional data structures using indices, row names, or column names
- Retreiving information from lists
- The %in% operator
Click here for a preview of this lesson
Very often you will have to compare two vectors to figure out if, and which, values are common between them. The%in%
operator can be used for this purpose.
This lesson will cover:
- Implementing the%in%
operator to evaluate two vectors
- Distinguishing%in%
from==
and other logical operators
- Usingany()
andall()
functions
- Reordering and matching
Click here for a preview of this lesson
Sometimes you will want to rearrange values within a vector (row names or column names). Thematch()
function can be very powerful for this task.
This lesson will cover:
- Maunually rearranging values within a vector
- Implementing thematch()
function to automatically rearrange the values within a vector
- Setting up a data frame to plot (+ the
map()
function)Click here for a preview of this lesson
We will be starting with visualization in the next class. To set up for this, you need to create a new metadata data frame with information from the counts data frame. You will need to use a function over every column within the counts data frame iteratively. You could do that manually, but it is error-prone; themap()
family of functions makes this more efficient.
This lesson will cover:
- Utilizingmap_dbl()
to take the average of every column in a data frame
- Briefly discuss other functions within themap()
family of functions
- Create a new data frame for plotting
II. Complete the exercises:
- Each lesson above contains exercises; please go through each of them.
- Copy over your solutions into the Google Form the day before the next class.
III. Prepare for in-class exercise:
- Download the animals.csv, by right-clicking on the link and “Save Link As…” to place the file into the
data
directory. - Read the
.csv
file into your environment and assign it to a variable calledanimals
. Be sure to check that your row names are the different animals. - Save the R project when you close Rstudio.
Questions?
- If you get stuck due to an error while runnning code in the lesson, email us
Day 3
Time | Topic | Instructor |
---|---|---|
10:00 - 10:35 | Questions about self-learning lessons | All |
10:35 - 11:15 | In-class exercises + Answer key | Will |
11:15 - 12:00 | Plotting with the ggplot2 package | Elizabeth |
Before the next class:
I. Please study the contents and work through all the code within the following lessons:
- Using custom functions for consistent plots
Click here for a preview of this lesson
When creating your plots in ggplot2 you may want to have consistent formatting (usingtheme()
functions) across your plots, e.g. if you are generating plots for a manuscript.
This lesson will cover:
- Developing a custom function for creating consistently formatted plots
- Generating a boxplot with ggplot2
Click here for a preview of this lesson
Previously, you created a scatterplot using ggplot2. However, ggplot2 can be used to create a very wide variety of plots. One of the other frequently used plots you can create with ggplot2 is a barplot.
This lesson will cover:
- Creating and customizing a barplot using ggplot2
- Writing to file and exporting plots
Click here for a preview of this lesson
Now that you have completed some analysis in R, you will need to eventually export that work out of R/RStudio. R provides lots of flexibility in what and how you export your data and plots.
This lesson will cover:
- Exporting your figures from R using a variety of file formats
- Writing your data from R to a file
- Finding help
Click here for a preview of this lesson
Hopefully, this course has given you the basic tools you need to be successful when using R. However, it would be impossible to cover every aspect of R and you will need to be able to troubleshoot future issues as they arise.
This lesson will cover:
- Suggestions for how to best ask for help
- Where to look for help
- Tidyverse
Click here for a preview of this lesson
The Tidyverse suite of integrated packages are designed to work together to make common data science operations more user friendly. Tidyverse is becoming increasingly prevalent and it is necessary that R users are conversant in the basics of Tidyverse. We have already used two Tidyverse packages in this workshop (ggplot2
andpurrr
) and in this lesson we will learn some key features from a few additional packages that make up Tidyverse.
This lesson will cover:
- Usage of pipes for connecting together multiple commands
- Tibbles for two-dimensional data storage
- Data wrangling within Tidyverse
II. Complete the exercises:
- Each lesson above contains exercises; please go through each of them.
- Copy over your solutions into the Google Form the day before the next class.
Questions?
- If you get stuck due to an error while runnning code in the lesson, email us
Day 4
Time | Topic | Instructor |
---|---|---|
10:00 - 10:35 | Questions about self-learning lessons | All |
10:35 - 11:15 | In-class exercises + Answer key | Will |
11:15 - 11:45 | Discussion, Q & A | All |
11:45 - 12:00 | Wrap Up | Will |
Final Exercises
Answer Keys
Building on the basic R knowledge
- DGE workshop
- Single-cell RNA-seq workshop
- RMarkdown
- Functional analysis
- More ggplot2
- ggplot2 cookbook
- Running R and Rstudio on O2