---
title: "EDA w/NMU enrollment data"
subtitle: "ACT scores"
toc-title: "Chapter 10: 10.4 - 10.8"
theme: flatly 
date: today
toc: true
format:
  html: 
    code-overflow: wrap
    toc: true
    toc-title: "Contents"
    # hide code?

execute:
  warning: false
  message: false
---


```{r}
library(tidyverse)
nmu <- read.csv("http://euclid.nmu.edu/~joshthom/Teaching/DAT309/Week6/10%20BOS%2010%20Year%20History%20Deidentified%2010.3.23.csv", sep  = "\t")
```

```{r}
nmu <- janitor::clean_names(nmu)

```

# compare ACT scores across a few major
```{r}
library(ggridges)
v <- nmu |> select(major) |> distinct() |> arrange(major)
filter(nmu, major %in% c(v$major[1],v$major[158],v$major[200])) |> 
    ggplot(aes(y = major, x = act, fill = factor(stat(quantile)))) +
    stat_density_ridges(
        geom = "density_ridges_gradient", calc_ecdf = TRUE,
        quantiles = 4, quantile_lines = TRUE
    ) +
    scale_fill_viridis_d(name = "Quartiles")
```

# Compare 10 random majors and Math
```{r}
some <- slice_sample(nmu, n = 10) |> select(major) 
filter(nmu, major %in% as.list(some$major) |
            major == "Mathematics") |> 
    ggplot(aes(y = fct_reorder(major,act), x = act, fill = factor(stat(quantile)))) +
    stat_density_ridges(
        geom = "density_ridges_gradient", calc_ecdf = TRUE,
        quantiles = 4, quantile_lines = TRUE
    ) +
    scale_fill_viridis_d(name = "Quartiles")
```


