Exercise

Getting data for multiple states

In the previous exercise, you learned how to combine datasets with the rbind_tigris() function. If you need data for more than two states, however, this process can get tedious. In this exercise, you'll learn how to generate a list of datasets for multiple states with the tidyverse map() function, and combine those datasets with rbind_tigris().

Instructions

100 XP
  • Generate a vector of state codes for Maine, New Hampshire, Vermont, and Massachusetts named new_england.
  • Use the tidyverse map() function to iterate through the vector of state codes.
  • Set the local variable x to request tract data for each state inside the function used by map().