Set Up Your Project and Load Libraries

Question 1: State Data

Part 1a) Creating the State data set

Start by creating a data set that has the name of the state and its population. Show the first 10 rows in the knitted document.

## # A tibble: 51 × 2
##    state_name           population
##    <chr>                     <int>
##  1 Alabama                 4893186
##  2 Alaska                   736990
##  3 Arizona                 7174064
##  4 Arkansas                3011873
##  5 California             39346023
##  6 Colorado                5684926
##  7 Connecticut             3570549
##  8 Delaware                 967679
##  9 District of Columbia     701974
## 10 Florida                21216924
## # ℹ 41 more rows

Part 1b) Create state_lines data set

Create the state_lines data set by joining a data set with the state borders with the states data set created in 1a). Again, show the first 10 rows of the data set.

## # A tibble: 15,537 × 8
##     long   lat group order region  subregion state_name population
##    <dbl> <dbl> <dbl> <int> <chr>   <chr>     <chr>           <int>
##  1 -87.5  30.4     1     1 alabama <NA>      Alabama       4893186
##  2 -87.5  30.4     1     2 alabama <NA>      Alabama       4893186
##  3 -87.5  30.4     1     3 alabama <NA>      Alabama       4893186
##  4 -87.5  30.3     1     4 alabama <NA>      Alabama       4893186
##  5 -87.6  30.3     1     5 alabama <NA>      Alabama       4893186
##  6 -87.6  30.3     1     6 alabama <NA>      Alabama       4893186
##  7 -87.6  30.3     1     7 alabama <NA>      Alabama       4893186
##  8 -87.6  30.3     1     8 alabama <NA>      Alabama       4893186
##  9 -87.7  30.3     1     9 alabama <NA>      Alabama       4893186
## 10 -87.8  30.3     1    10 alabama <NA>      Alabama       4893186
## # ℹ 15,527 more rows

Part 1c) Map of population

Create a map that shows the population of each state. It should look similar to what is in Brightspace, but doesn’t have be identical! Hint: A log10 transformation was applied to population!

Question 2) County Map

Part 2a) County Lines data

Start by creating the county_lines data that has the:

  1. name of the state
  2. name of the county 3 & 4) latitude and longitude for the county border
  3. the FIPS ID for the county

The pdf in Brightspace has the first 10 rows. Make sure that the data set you create matches it!

## # A tibble: 87,949 × 8
##     long   lat group order region  subregion state_county     fips
##    <dbl> <dbl> <dbl> <int> <chr>   <chr>     <chr>           <int>
##  1 -86.5  32.3     1     1 alabama autauga   alabama,autauga  1001
##  2 -86.5  32.4     1     2 alabama autauga   alabama,autauga  1001
##  3 -86.5  32.4     1     3 alabama autauga   alabama,autauga  1001
##  4 -86.6  32.4     1     4 alabama autauga   alabama,autauga  1001
##  5 -86.6  32.4     1     5 alabama autauga   alabama,autauga  1001
##  6 -86.6  32.4     1     6 alabama autauga   alabama,autauga  1001
##  7 -86.6  32.4     1     7 alabama autauga   alabama,autauga  1001
##  8 -86.6  32.4     1     8 alabama autauga   alabama,autauga  1001
##  9 -86.6  32.4     1     9 alabama autauga   alabama,autauga  1001
## 10 -86.6  32.4     1    10 alabama autauga   alabama,autauga  1001
## # ℹ 87,939 more rows

Part 2b) Creating the county population map

Using the county_lines and counties data sets, create a map for the population of each county. Add the border for each state to the map as well.

Like the previous map, it should be similar to the graph found in blackboard, but it doesn’t need to be identical. Pay attention to the fill scale for population!

## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

Part 2c) County Population proportion of the State population

Using the counties data set, create a column that represents the county’s population percentage of the state’s population.

For example, if Vermont has 600,000 people and Chittenden county had 120,000 it would be 0.20 or 20% (either proportion or percentage is fine).

Show the counties in Vermont in the knitted document!

##        county       county_full  FIPS state_abbv state_name population
## 1     Addison    Addison County 50001         VT    Vermont      36947
## 2  Bennington Bennington County 50003         VT    Vermont      35649
## 3   Caledonia  Caledonia County 50005         VT    Vermont      30027
## 4  Chittenden Chittenden County 50007         VT    Vermont     163414
## 5       Essex      Essex County 50009         VT    Vermont       6179
## 6    Franklin   Franklin County 50011         VT    Vermont      49275
## 7  Grand Isle Grand Isle County 50013         VT    Vermont       7075
## 8    Lamoille   Lamoille County 50015         VT    Vermont      25376
## 9      Orange     Orange County 50017         VT    Vermont      28873
## 10    Orleans    Orleans County 50019         VT    Vermont      26843
## 11    Rutland    Rutland County 50021         VT    Vermont      58527
## 12 Washington Washington County 50023         VT    Vermont      58336
## 13    Windham    Windham County 50025         VT    Vermont      42628
## 14    Windsor    Windsor County 50027         VT    Vermont      55191
##        pop_per
## 1  0.059177692
## 2  0.057098696
## 3  0.048093987
## 4  0.261738796
## 5  0.009896851
## 6  0.078923343
## 7  0.011331967
## 8  0.040644521
## 9  0.046245635
## 10 0.042994202
## 11 0.093742192
## 12 0.093436269
## 13 0.068276900
## 14 0.088398949

Part 2d) Map of County Population Proportion

Create a graph that presents the county’s percentage (or proportion) of the state’s population. It should look similar to the one in blackboard!

What two counties stand out and why? What does the map tells us about those two counties?