Data Analysis on Leading Causes of Mortality by U.S. County

Posted on Oct 20, 2020
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

LinkedInGitHubEmail | Data | Web App

Venit Mors Velocitor


Why would it be helpful to know the data on the leading causes of mortality of a given population at a granular level and how they have been trending? Well, does it come into play when considering places to live or travel? Would having a large sample size not aid one’s research or clinical trial(s)? And what about for curiosity’s sake?

Despite these possible motivations, this was not my first project idea. Some others I attempted to find data to support the visualization of were:

  • The worldwide concentration and dispersion of natural resources over time.
  • The interactions amongst a country’s poverty level, happiness ranking and corruption index.

When I decided to pursue deaths by region, the functionality I desired to provide included allowing the user to input their sex, U.S. county, age, race, and potentially other relevant demographic information. The idea was to use those variables to identify which cause of death would most pertain to the user.

Alas, it was not to be since obtaining such a detailed dataset, or any recent, substantial mortality dataset for that matter, seemed to involve a lengthy process with the CDC. As I settled into this topic, I thought about the visualizations and information I wished to display, adjusted my expectations, and decided to focus on the map as my central feature. Unfortunately, I did not foresee the difficulties I would have with creating a working, snappy version. I will touch upon these problems later on.


R Shiny App Overview

The data is too large to be hosted with a free account but the code for my app can be accessed via my GitHub link included above. When running the app, you will be greeted by the following screen:

Data Analysis on Leading Causes of Mortality by U.S. County
Main Screen

The main navigation will occur via the sidebar menu on the left hand side. The different selections on the menu determine what’s displayed on the central panel, e.g. a map (by default), a data table, etc.

Data Analysis on Leading Causes of Mortality by U.S. County
Sidebar Menu

The input box on the sidebar menu labeled “Cause of Mortality” affects what is displayed or selected on the map, data table, bar chart, and the first two line graphs on the “Trends” panel. The third graph on the “Trends” panel has its own input box allowing for multiple mortality causes to be selected simultaneously. The “About Me” and “Download” panels are self-explanatory.

R is generally the most popular programming language among data scientists after Python. Delving into Shiny is a natural step of learning R. “Shiny is an open source R package that provides an elegant and powerful web framework for building web applications using R. Shiny helps you turn your analyses into interactive web applications without requiring HTML, CSS, or JavaScript knowledge” (


Data Trends

Country-wide trends from 1980 to 2014:

All Causes

Cardiovascular Diseases

Chronic Respiratory Diseases

Cirrhosis And Other Chronic Liver Diseases

Communicable, Maternal, Neonatal, And Nutritional Diseases

Diabetes, Urogenital, Blood, And Endocrine Diseases

Diarrhea, Lower Respiratory, And Other Common Infectious Diseases

Digestive Diseases

Forces Of Nature, War, And Legal Intervention (spike on Sept. 11 2001)

HIV/AIDS And Tuberculosis


Maternal Disorders

Mental And Substance Use Disorders

Musculoskeletal Disorders

Neglected Tropical Diseases And Malaria

Neonatal Disorders


Neurological Disorders

Non-Communicable Diseases

Nutritional Deficiencies

Other Communicable, Maternal, Neonatal, And Nutritional Diseases

Other Non-Communicable Diseases

Self-Harm And Interpersonal Violence

Transport Injuries

Unintentional Injuries 

Mortality Rates

Simply knowing whether a cause of mortality has been trending upwards or downwards overtime does not tell the whole story. Take, for instance, the following graph:

Data Analysis on Leading Causes of Mortality by U.S. County

Some categories have large spikes that cannot simply be ignored. Diving a little deeper we can determine the states in which the forces of nature, war, and/or legal intervention took place.

Of the four states clearly impacted by some events, we see that primary contributors to the spikes are New York and Louisiana.

The spike in New York (and New Jersey) can be traced back to the September 11 attacks on the morning of Tuesday, September 11, 2001. Part of the attacks saw two planes crash into the World Trade Center in New York City. They are the deadliest terrorist attacks in world history (

The spike in Louisiana (and Mississippi) can be attributed to Hurricane Katrina, which occurred in August 2005. Much of the destruction occurred in the city of New Orleans. Katrina is the 7th most intense Atlantic Hurricane on record and is tied as the costliest tropical cyclone on record (


Data Outliers?

One particular instance led me to question the veracity of the data. I was visualizing various mortality causes on the map and noticed something strange after selecting “HIV/AIDS and tuberculosis”: The entire country of the United States was different shades of pale yellow except for a purple section in the State of Florida. Clicking it revealed “Union Country.”

How could the average mortality rate amongst all counties in the USA be 1.544 but be 65.675 in Union County, Florida? Things did not add up, especially when upon closer inspection Union County also had the highest mortality rate in other categories:

  • Communicable, Maternal, Neonatal, And Nutritional Diseases
  • Neoplasms
  • Other Communicable, Maternal, Neonatal, And Nutritional Diseases

Understanding the composition of Union County’s population and some external problems it faced gave me some insight. It turns out that a third of its population consists of inmates of the Union Correctional Institution. That alone explains a lot since prison populations are disproportionately sicker than the general population. The county also lacks government funding and features a high percentage of poverty (read://

The ability to create insightful visualizations and tell interesting stories about them is a fundamental aspect of Data Science.



The map proved to be a major challenge that cost countless hours. Some of the resources I utilized are below:


When I finally had a working map, I found that in addition to the load time when starting the app, there would be a load time whenever a different mortality cause was selected, making the app nearly unusable. I was ultimately able to greatly reduce the load time when selecting new causes with a mentor's help. He pointed me to a solution that utilized JavaScript that would allow the map to change the colors of the polygons without redrawing all the polygons after each cause was selected.

However, I would not be able to display the new mortality rates with the popup information that would show after clicking a county. That tradeoff was fine; the user could get a good idea of the mortality rate by using the legend. 



R Shiny app available online:

About Author

Tyrone Wilkinson

| Data Scientist | I love tackling interesting problems. With a degree in Computer Science from Columbia University and background and IT experience spanning over 5 years, I now leap into AI. Contact me if you want to...
View all posts by Tyrone Wilkinson >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI