Programming with R

The best way to learn how to program is to do something useful, so this introduction to R is built around a common scientific task: data analysis.

Our real goal isn’t to teach you R, but to teach you the basic concepts that all programming depends on. We use R in our lessons because:

  1. we have to use something for examples;
  2. it’s free, well-documented, and runs almost everywhere;
  3. it has a large (and growing) user base among scientists; and
  4. it has a large library of external packages available for performing diverse tasks.

But the two most important things are to use whatever language your colleagues are using, so you can share your work with them easily, and to use that language well.

Our goal is to be able to

Prerequisites

Learners need to understand the concepts of files and directories (including the working directory). We use RStudio to teach this lesson but it is not strictly required if you prefer some other way of interacting with R. Check that your installation is sufficient by calling source("https://goo.gl/J8gVWx")in R.

Schedule

Setup Download files required for the lesson
00:00 1. A brief introduction to R What is R and when should I use it?
How do I use the RStudio graphical user interface?
How do I assign variables?
How can I create a function?
00:40 2. Reading data to a data frame and performing basic operations What is a data frame?
How do I access subsets of a data frame?
How do I calculate simple statistics like mean and median?
How can I access documentation?
How do I install a package?
How do I reshape data?
01:10 3. Using ggplot2 to visualize your data What is ggplot2 and why should I use it?
What are aes and geom?
How do I make a basic plot?
What geoms are available?
How can I best visualize groups of data?
01:45 4. Explore a gene expression data set How do I get an overview of an RNA-seq dataset?
How do I calculate differentially expressed genes?
How do I find enriched biological processes?
02:30 5. Getting help How do I use R to do X?
What to do with error X?
02:45 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.