Exercise

Tidy and wide data in tidycensus

By default, tidycensus functions return tidy data frames, in which each row represents a unique unit-variable combination. However, at times it is useful to have each Census variable in its own column for some methods of visualization and analysis. To accomplish this, you can set output = "wide" in your calls to get_acs() or get_decennial(), which will place estimates/values and margins of error in their own columns.

Instructions

100 XP
  • Get ACS data on median household income and median age for counties in Oregon in wide format by specifying output = "wide".
  • Check the first few rows of your wide data frame.
  • Create a scatter plot of median household income and median age with the plot() function.