library(tidyverse)
## ── Attaching packages ─────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.1       ✔ purrr   0.3.2  
## ✔ tibble  2.1.1       ✔ dplyr   0.8.0.1
## ✔ tidyr   0.8.3       ✔ stringr 1.4.0  
## ✔ readr   1.3.1       ✔ forcats 0.4.0
## ── Conflicts ────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
dat <- read_csv("https://bit.ly/2sqZ1k5")
## Parsed with column specification:
## cols(
##   id = col_double(),
##   gender = col_character(),
##   race = col_character(),
##   ses = col_character(),
##   schtyp = col_character(),
##   prog = col_character(),
##   read = col_double(),
##   write = col_double(),
##   math = col_double(),
##   science = col_double(),
##   socst = col_double()
## )
dat
dat %>% ggplot(aes(x=read, y=write)) + geom_point()

ggplot(dat, aes(x=read, y=write)) + geom_point(color='steelblue') + geom_smooth(method='lm')

dat %>% ggplot(aes(x=read, y=write, shape=gender)) + geom_point()

ggplot(dat, aes(x=read, y=write, color=ses)) + geom_point(aes(shape=gender)) + geom_smooth(method='lm', se = FALSE) + facet_wrap(~ schtyp, nrow=3)

dat %>% ggplot(aes(x=read, y=..density..)) + geom_histogram(binwidth = 10) + geom_density()

dat %>% ggplot(aes(x=read, y=..density..)) + geom_density(aes(color=gender, fill=gender), alpha=0.3)