4 Visualization I

This lecture introduces you to the basics of “the grammar of graphics”, which underlies the R package ggplot2. You will gain a basic understanding of how to visualize your data for exploratory purposes. In particular, you will be able to read and write R code such as the one below, which produces the figure shown beneath the code.

Lecture slides: Visualization I

Today’s exercise: Web Excercise 4

ggplot(data = ESS, 
       mapping = aes(y = imwbcnt, x = factor(eduyrs), weight = pspwght)) +
  geom_boxplot() +
  geom_smooth(mapping = aes(group = 1)) +
  facet_wrap( ~ cntry, nrow = 1) + 
  labs(y = "Immigrants make country \n worse place to live", 
       x = "Years of Education")

Homework

  1. Finish web exercise 3 and 4.
  2. Read Chapter 3 Data Visualization.
  3. Read Chapter 7 Exploratory Data Analysis.