Week 5

Package ggplot2

Monday, Feb 3

Learning objectives

  • Understand ggplot anatomy
  • Plot aesthetics
  • Plot facets
  • Best practices for visualizations

Materials


Advanced visualizations

Wednesday, Feb 5

Learning objectives

  • Organize objects of class gg with package patchwork
  • Create parliament plots
  • Build animations with packages gganimate and gifski
  • Build interactive plots with package ggiraph

Materials


Lab 5

Friday, Feb 7

GitHub

Learning objectives

  • Subsetting lists
  • Manipulating files using the command line
  • Understand the difference between tibbles and data frames
  • Effective visualizations with ggplot2

Materials


Exercise of the week

To get started, load package tidyverse, and load the flint.csv data.

library(tidyverse)
flint <- read_csv("http://www2.stat.duke.edu/~sms185/data/health/flint.csv")

Recreate the plot below using package ggplot2.

Some details to help you replicate the plot:

  • remove zip codes 48529 and 48502
  • color choices: red, “#256d7b”
  • font size: 16
  • theme_bw()
Previous
Next