Import Data

sports <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-03-29/sports.csv')
## Rows: 132327 Columns: 28
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (8): institution_name, city_txt, state_cd, zip_text, classification_nam...
## dbl (20): year, unitid, classification_code, ef_male_count, ef_female_count,...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
sports <- sports %>%
    filter(institution_name == "Troy University")
sports
## # A tibble: 74 × 28
##     year unitid instit…¹ city_…² state…³ zip_t…⁴ class…⁵ class…⁶ class…⁷ ef_ma…⁸
##    <dbl>  <dbl> <chr>    <chr>   <chr>   <chr>     <dbl> <chr>   <chr>     <dbl>
##  1  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  2  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  3  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  4  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  5  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  6  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  7  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  8  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
##  9  2015 102368 Troy Un… Troy    AL      360820…       1 NCAA D… <NA>       3530
## 10  2016 102368 Troy Un… Troy    AL      36082         1 NCAA D… <NA>       3711
## # … with 64 more rows, 18 more variables: ef_female_count <dbl>,
## #   ef_total_count <dbl>, sector_cd <dbl>, sector_name <chr>, sportscode <dbl>,
## #   partic_men <dbl>, partic_women <dbl>, partic_coed_men <dbl>,
## #   partic_coed_women <dbl>, sum_partic_men <dbl>, sum_partic_women <dbl>,
## #   rev_men <dbl>, rev_women <dbl>, total_rev_menwomen <dbl>, exp_men <dbl>,
## #   exp_women <dbl>, total_exp_menwomen <dbl>, sports <chr>, and abbreviated
## #   variable names ¹​institution_name, ²​city_txt, ³​state_cd, ⁴​zip_text, …

Introduction

Questions

Variation

Visualizing distributions

ggplot(data = sports) +
    geom_bar(mapping = aes(x = sum_partic_men)) 

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

Typical values

Unusual values

Missing Values

Covariation

A categorical and continuous variable

Two categorical variables

Two continous variables

Patterns and models