Import Data

data <- read.csv("../00_data/myData.csv")

Introduction

Questions

Variation

ggplot(data = LifeExpectancy) +
    geom_bar(mapping = aes(x = Year))

Visualizing distributions

ggplot(data = LifeExpectancy) +
    geom_histogram(mapping = aes(x = LifeExpectancy), binwidth = 0.5)

Typical values

ggplot(data = LifeExpectancy, mapping = aes(x = Year)) +
  geom_histogram(binwidth = 1.0)

Unusual values

ggplot(LifeExpectancy) + 
  geom_histogram(mapping = aes(x = LifeExpectancy), binwidth = 0.5) +
  coord_cartesian(ylim = c(0, 50))

Missing Values

Covariation

ggplot(data = LifeExpectancy, mapping = aes(x = Year)) +
    geom_freqpoly(mapping = aes(colour = Entity), binwidth = 500)

A categorical and continuous variable

ggplot(data = LifeExpectancy, mapping = aes(x= Year, y = LifeExpectancy)) +
    geom_boxplot()
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?

Two categorical variables

ggplot(data = LifeExpectancy) +
    geom_count(mapping = aes(x = Year, y= LifeExpectancy))

Two continous variables

ggplot(data = LifeExpectancy) +
    geom_point(mapping = aes(x = Year, y = Entity))

ggplot(data = diamonds2) + geom_boxplot(mapping = aes(x = cut, y = resid)) ## Patterns and models

ggplot(data = LifeExpectancy) +
    geom_boxplot(mapping = aes(x = Year, y = LifeExpectancy))
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?