Import data

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

Introduction

Questions

Variation

Visualizing distributions

ggplot(data = salary) +
    geom_bar(mapping = aes(x = year))

ggplot(data = salary) +
    geom_histogram(mapping = aes(x = category_id))
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 16 rows containing non-finite values (`stat_bin()`).

ggplot(data = salary, mapping = aes(x = like_count, color = brand)) +
    geom_freqpoly()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 22 rows containing non-finite values (`stat_bin()`).

Typical values

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

Unusual values

ggplot(salary) + 
  geom_histogram(mapping = aes(x = category_id), binwidth = 0.5)
## Warning: Removed 16 rows containing non-finite values (`stat_bin()`).

Missing Values

ggplot(data = salary, mapping = aes(x = year, y = dislike_count)) + 
  geom_point()
## Warning: Removed 22 rows containing missing values (`geom_point()`).

Covariation

ggplot(data = salary, mapping = aes(x = year)) + 
  geom_freqpoly(mapping = aes(colour = brand), binwidth = 500)

A categorical and continuous variable

ggplot(data = salary, mapping = aes(x = year)) + 
  geom_boxplot(mapping = aes(colour = brand), binwidth = 500)
## Warning in geom_boxplot(mapping = aes(colour = brand), binwidth = 500):
## Ignoring unknown parameters: `binwidth`

### Two categorical variables

ggplot(data = salary) +
  geom_tile(mapping = aes(x = kind, y = funny))

Two continous variables

ggplot(data = salary) +
  geom_point(mapping = aes(x = view_count, y = like_count))
## Warning: Removed 22 rows containing missing values (`geom_point()`).

Patterns and models

ggplot(data = salary) + 
  geom_point(mapping = aes(x = year, y = funny))