Below you can find an interactive U.S. Election Map for the years 1916-2020.
QOG logo

Information about this Dashboard:

The provided dashboard showcases an interactive map visualizing U.S. county voting patterns from 1916 to 2020. Users can explore vote shares by party, examine trends over time, and dive into county-level data. On the second page of the dashboard, each county is categorized by voting trends, with visualizations showing aggregated (by sum) vote percentages by category, the location of counties in each category, and individual county’s vote share across the years.

Brief Explanation of the Methodology Behind the Second Page:

Each county was categorized into 1/4 broad voting trends: 1) Trending Moderately to Very Republican 2) Trending Slightly to Moderately Republican 3) Trending Slightly Democratic/Republican (i.e. relatively unchanged over time) and 4) Trending Slightly to Very Democratic. The way these categories were determined were by running a linear regression on every county predicting the vote share of the Republican Party from the election year, which were standardized (1,2,3…) to include counties that didn’t exist until later years. Negative regression coefficients indicated a trends towards the Democrats while positive coefficients indicated trends towards Republicans. The regression coefficients were then split into quartiles (0-25%, 25-50%, 50-75%, 75-100%) to determine the categories. Read more about linear regression here and quartiles here.

Following the categorization, locations of the counties in each category were mapped and the total vote share of each county was calculated (meaning the sum of ALL Republican OR Democratic votes across election years divided by the sum of ALL Republican AND Democratic votes across election years). A line graph of vote share for each election year by category was also created following the same logic, except ALL the results of the first operation were summed by election-year to get a category-wide number.

Resources Used to Create the Dashboard:

This dashboard was created by using Quarto in R. Quarto allows for R/Python (and many more) users to build Websites, Books, Dashboards, and many other web-based tools. Visit Quarto to learn more about how to build different types of content.

In addition to Quarto, the following R packages were used:

  1. Highcharter

    Kunst, J. (2022). Highcharter: A wrapper for the ‘Highcharts’ library. (Version 0.9.4) [R package]. CRAN. https://CRAN.R-project.org/package=highcharter

  2. Sf

    Pebesma, E. (2024). Sf: Simple Features for R. (Version 1.0-18) [R package]. CRAN. https://CRAN.R-project.org/package=sf

  3. Tidyverse

    Wickham, H. (2023). Tidyverse: Easily Install and Load the ‘Tidyverse’ . (Version 2.0.0) [R package]. CRAN. https://CRAN.R-project.org/package=tidyverse

  4. jsonlite

    Ooms, J. (2024). Jsonlite: A Simple and Robust JSON Parser and Generator for R. (Version 1.8.9) [R package]. CRAN. https://CRAN.R-project.org/package=jsonlite

  5. geojsonio

    Mahoney, M. (2023). Geojsonio: Convert Data from and to ‘GeoJSON’ or ‘TopoJSON’ . (Version 0.11.3) [R package]. CRAN. https://CRAN.R-project.org/package=geojsonio

  6. broom

    Couch, S. (2024). Broom: Convert Statistical Objects into Tidy Tibbles. (Version 1.0.7) [R package]. CRAN. https://CRAN.R-project.org/package=broom

The data-sets used in the creation of the dashboard are listed below:

**In addition to R, Quarto, and the above packages, HTML, Javascript, and CSS were used to create a svg that serves as the legend in the map.

Reproduction and Contact Information:

If you have any questions or are interested in learning about how the dashboard was created, please contact Lauren Gerber or visit the Github for the code you can use to reproduce the dashboard.

For other questions about QoG Data, please contact here.