library(foreign) # load Stata datasets
library(ggplot2) # main graphics package
library(dplyr) # data manipulation tools
library(cleanplots) # Mize's graphics scheme
## Use cleanplots colors, markers, lines, and theme for all graphs ##
cleanplots_defaults()
theme_update(plot.title.position = "plot") # titles start at left edge of graph
# General Social Survey Data
gss <- droplevels(read.dta("https://tdmize.github.io/data/data/gss.dta"))
# 1.a - Frequency option to plot # of observations in each bin
ggplot(gss, aes(x = wages)) +
geom_histogram(fill = NA, color = "gray20") +
labs(x = "Wages", y = "Frequency",
title = "[1.a] Histogram of Distribution of Hourly Wages",
subtitle = "y-axis shows number of observations in bin") +
scale_x_continuous(breaks = seq(0, 70, 10))