In this homework, we plot the mean wages over the US states. Start by
creating a new RMarkdown document named hw7-wages.Rmd using
the standard homework format.
The purpose of this analysis is to visualize the average wages for the different US states.
library(tidyverse)
library(readxl)
library(tigris)
The data for this homework come from two sources.
tigris dataset provides the state geographies.us_state_geographies <- tigris::states() %>%
shift_geometry()
## Retrieving data for the year 2021
Nb. The shift_geometry() function re-plots the non-continental US states closer to the rest. This creates a more compact geographic plot, but it may not work properly on some RStudio platforms. If it generates errors, feel free to drop that call from this code chunk.
state_mean_wages_raw <-
read_excel("data/BLS-wages-by-state.xlsx",
col_types = c("text", "numeric"),
skip = 4)
You’ll combine these datasets to produce geospatially-categorized wage data, and focus only on the rows for the 50 states.
Produce a choropleth visualization that shows the average annual wages for all 50 states.
Do you notice any interesting patterns in this data?