---
title: "Mini-Project 1"
subtitle: "(now) Due: September 23"
toc-title: "Exploratory Data Analysis w/Ch. 1-3"
date: today
toc: true
format:
  html: 
    toc: true
    toc-title: "Table of Contents"
    # hide code?

execute:
  warning: false
  message: false
---

In your first project you are to use tools learned this far to explore a real dataset.

## Datasets

Use one of these datasets below:

1.  American Time Use Survey
    i) From the U.S. Bureau of Labor Statistics
    ii) ATUS Overview - [link]("https://www.bls.gov/tus/")
    iii) The codebook: [link]("https://euclid.nmu.edu/~joshthom/teaching/dat309/week2/ATUS2/codebook2.txt")
    iv) Load the data via:
    
    ```{r}
    library(tidyverse)
    atus_data <- read_rds("https://euclid.nmu.edu/~joshthom/teaching/dat309/week2/ATUS2/ATUS_data.RDS")
    ```
  
2. Panel Study of Income Dynamics
    i) Based at the University of Michigan
    ii) PSID Overview - [link](https://psidonline.isr.umich.edu/)
    iii) How to Download: - [link](psid-intro.html)
  
## Required Components
1. Use one of the datasets above.
2. Submit a .html file rendered via Quarto / Rmarkdown.
3. Present your project to class: 3-5 minutes (max!)
4. Use
    (i) `ggplot()` with good labels & legends
    (ii) `filter()`
    (iii) `select()`
    (iv) `facet_wrap()` or `facet_grid()`
    (v) `rename()`
    (vi) `group_by()` & `summarize()`
5. Include the following plots
    (i) barplot
    (ii) boxplot
    (iii) scatterplot
6. Include a brief summary and conclusion.  
7. Include a brief discussion each of your plots.  Two-three sentences should suffice.

## Tips
1. Create an R-script to do your exploratory work.
2. Comment well.  
3. After you have some good plots and/or statistics, copy your work into the .qmd file.
4. Remember, your `markdown` environment is different than your console, so you will have to load the data/tidyverse again.  
5. [This page](https://haven.tidyverse.org/articles/semantics.html) sheds light on the **haven** package we're using with the ATUS data.  Two tools that might be useful:

```{r}
library(tidyverse)
library(janitor)

df <- read_rds("https://euclid.nmu.edu/~joshthom/teaching/dat309/week2/ATUS2/ATUS_data.RDS") |> clean_names()

# make the hvn+lbl a factor
new_atus <- df |> mutate(sex =  haven::as_factor(sex))
# use the number part of the hvn+lbl variable
new_atus <- new_atus |> mutate(sex = haven::zap_labels(sex))
```



```{r}
library(tidyverse)
atus_data <- read_rds("https://euclid.nmu.edu/~joshthom/teaching/dat309/week2/ATUS2/ATUS_data.RDS")
# filter(data, )
```


