Session Ready
Exercise

Merging demographic and voting data

As mentioned in the previous exercise, demographic and political data only become helpful for answering causal questions when they are able to be viewed side by side. In R, you can combine datasets that have at least one variable in common with the left_join() function from the dplyr package.

Instructions
100 XP
  • Rename the region variable in the df_county_demographics to be "county.fips". This way, the left_join() function will be able to find a common variable with the uspres_county dataset.
  • Merge the two datasets with the left_join() function.