Packages

library(tidyverse)

Data

MLB

teams <- read_csv("http://www2.stat.duke.edu/~sms185/data/mlb/teams.csv")

Object teams is a data frame that contains yearly statistics and standings for MLB teams from 2009 to 2018.

The data has 300 rows and 56 variables.

Energy

energy <- read_csv("http://www2.stat.duke.edu/~sms185/data/energy/energy.csv")

The power sources represent the amount of energy a power source generates each day as represented in daily MWh.

  • MWhperDay: MWh of energy generated per day
  • name: energy source name
  • type: type of energy source
  • location: country of energy source
  • note: more details on energy source
  • boe: barrel of oil equivalent


  • Daily megawatt hour (MWh) is a measure of energy output.
  • 1 MWh is, on average, enough power for 28 people in the USA

Flint water

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

Each row represents a home in Flint, Michigan. Water lead contaminant value were recorded at three times as represented by draw1, draw2, and draw3.

Exercise 1

Problem

Use tibble teams to re-create the plot below.