The following data was downloaded directly from the CDC website

Loading in Data and Libraries

library(leaflet)
library(leaflet.extras)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.6     ✓ dplyr   1.0.8
## ✓ tidyr   1.2.0     ✓ stringr 1.4.0
## ✓ readr   2.1.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(readxl)
longlat <- readxl::read_excel("/Users/admin/Desktop/uscounties.xlsx")
Obesity <- read_excel("/Users/admin/Desktop/IHME_county_data_LifeExpectancy_Obesity_PhysicalActivity_NATIONAL.xlsx")

merging datasets

The Obesity data from the CDC website did not include latitude and longitude, so I got the latitude and longitude information from a different data set and merged the two

mergeddata <- merge(longlat,Obesity,by.x = "county",by.y = "County")
newdata <- mergeddata[c(1,7,8,10:12)]
newdata <- rename(newdata,Latitude = lat)
newdata <- rename(newdata,Longitude = lng)
newdata$AvgObesity <- rowMeans(newdata[ , c(5,6)], na.rm=TRUE)
str(newdata)
## 'data.frame':    14968 obs. of  7 variables:
##  $ county                              : chr  "Abbeville" "Acadia" "Accomack" "Ada" ...
##  $ Latitude                            : num  34.2 30.3 37.8 43.5 37.1 ...
##  $ Longitude                           : num  -82.5 -92.4 -75.6 -116.2 -85.3 ...
##  $ State                               : chr  "South Carolina" "Louisiana" "Virginia" "Idaho" ...
##  $ Male obesity  prevalence, 2011* (%) : num  38.5 41.6 41 31.4 40.9 37.3 34.5 40.7 40.9 37.3 ...
##  $ Female obesity prevalence, 2011* (%): num  42.5 38.7 45.3 30.2 45.9 33.9 38.8 43.4 45.9 33.9 ...
##  $ AvgObesity                          : num  40.5 40.2 43.1 30.8 43.4 ...

Using Leaflet to represent the average % of obesity prevelance in 2011 between males and females

The map looks a bit messy from afar, but when you zoom in, you can clearly see which counties in the US have the highest percent of obesity prevelance.

newdata <- newdata[!is.na(newdata$Longitude)&!is.na(newdata$Latitude),]
newdata %>% 
  leaflet() %>% 
  addTiles() %>%
  leaflet.extras::addHeatmap(lng = ~Longitude, lat = ~Latitude, intensity = newdata$AvgObesity, max = 80, radius = 30, blur = 40) %>%
  addMarkers(popup = newdata$county, clusterOptions=markerClusterOptions())