Skip to the content.

Workshop Schedule

Day 1

Time Topic Instructor
10:00 - 10:30 Workshop Introduction Meeta
10:30 - 11:45 Introduction to R and RStudio Noor
11:45 - 12:00 Overview of self-learning materials and homework submission Meeta

Before the next class:

I. Please study the contents and work through all the code within the following lessons:

  1. 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

  2. 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

  3. 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:

Questions?


Day 2

Time Topic Instructor
10:00 - 10:50 Questions about self-learning All
10:50 - 11:15 In-class exercises + Answer key Heather
11:15 - 12:00 Data Wrangling: Subsetting Vectors and Factors Meeta

Before the next class:

I. Please study the contents and work through all the code within the following lessons:

  1. 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

  2. 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

  3. 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
    - Using any() and all() functions

  4. 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). The match() function can be very powerful for this task.

    This lesson will cover:
    - Maunually rearranging values within a vector
    - Implementing the match() function to automatically rearrange the values within a vector

  5. 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; the map() family of functions makes this more efficient.

    This lesson will cover:
    - Utilizing map_dbl() to take the average of every column in a data frame
    - Briefly discuss other functions within the map() family of functions
    - Create a new data frame for plotting

II. Complete the exercises:

III. Prepare for in-class exercise:

Questions?


Day 3

Time Topic Instructor
10:00 - 10:35 Questions about self-learning lessons All
10:35 - 11:15 In-class exercises + Answer key Meeta
11:15 - 12:00 Plotting with the ggplot2 package Heather

Before the next class:

I. Please study the contents and work through all the code within the following lessons:

  1. 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 (using theme() 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
  2. 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
  3. 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
  4. 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
  5. 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 and purrr) 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:

Questions?


Day 4

Time Topic Instructor
10:00 - 10:35 Questions about self-learning lessons All
10:35 - 11:15 In-class exercises + Answer key Heather
11:15 - 11:45 Discussion, Q & A All
11:45 - 12:00 Wrap Up Meeta

Final Exercises

Answer Keys

Building on the basic R knowledge

Resources

Cheatsheets