---
title: "Stat. 651 Quiz 2"
author: "Prof. Eric A. Suess"
date: "Wednesday November 18, 2020"
output:
  word_document: default
  pdf_document: default
  html_notebook: default
---

**Instructions:**   This is an open book, open notes, and open Google/internet test.  This is a closed phone and closed neighbor test.  You may use R on your own computer.  You may use a calculator.

Type your answers to the questions into an R Notebook.  Answer the questions in order.  Answer each the question that is asked above your R code chunks.  You must write a sentence containing your answer.  

Your files should have a name in the usual form for the class **lastname_firstname_Stat651_Quiz.Rmd** and **lastname_firstname_Stat651_Quiz.docx**.  Submit **both** files in Backboard before the end of class period.  

**Academic Honesty:** As a student at CSU East Bay you are held to the standards stated in the Academic Dishonesty Policy.  Copying another student’s work or allowing another student to copy your work is academically dishonest.  I expect you to be academically honest while taking the test.

These questions are related to the homework in Chapter 11 and 14.

Load the *choroplethr* and *choropletherMaps* packages.

```{r message=FALSE}
library(pacman)
p_load( tidyverse, choroplethr, choroplethrMaps, rUnemploymentData )
data(df_state_age_2010)
data(df_state_age_2015)
```

1. For the *df_state_age_2010* and *df_state_age_2015* data sets in the *choroplethr* R package, answer the following:

    (a) What are the variable names in these data frames?
    (b) Make state choropleth maps for the median age of people in each state, for 2010 and 2015, using the *state_choropleth()* function.
    (c) Which states have the oldest populations in 2010? And in 2015?
    
**Answer:**

```{r}

```    

2. For the *df_pop_state* data set in the *choroplethr* R package, answer the following:

    (a) Make a state choropleth map for the population of people in each state using the *state_choropleth()* function.
    (b) Which states have the highest population?
    
**Answer:**

```{r}

```

3. For the *df_state_demographics* data set in the *choroplethr* R package, answer the following:

    (a) Make a state choropleth map for the per capita income in each state using the *state_choropleth()* function.
    (b) Which states have the highest per capita income?
    
**Answer:**

```{r}

```

4. Load the *rUnemploymentData* R package.  Run the *animated_county_unemployment_choropleth()* function to create the maps.  Find the *animated_choropleth.html* file and run the dynamic visualization.  Answer the following:

    (a) Between 1990 and 2013 has the SF Bay Area every had very high unemployement rates relative to the highest unemployment counties in the country?
    (b) What is wrong with the scale used for the color used in the maps?
    
**Answer:**

```{r}

```

5. Try the same visualizations in Tableau at home.  


```{r eval = FALSE}
data(df_county_unemployment)

write_csv(df_county_unemployment, "df_county_unemployment.csv")
```

**Suggestion:**  Before kitting your R Notebook you should comment out this code so that the pictures are not regenerated.  It takes quite a while to generate the plots and longer during the knitting process.  There is no output shown, so there is no reason to rerun it.
