library(tidyverse)
library(tidyr)
setwd("C:/Users/satad/Downloads")
cities500 <- read_csv("500CitiesLocalHealthIndicators.cdc.csv")GIS project
load the libraries
The GeoLocation variable has (lat, long) format
Split GeoLocation (lat, long) into two columns: lat and long
latlong <- cities500 |>
mutate(GeoLocation = str_replace_all(GeoLocation, "[()]", "")) |>
separate(GeoLocation, into = c("lat", "long"), sep = ",", convert = T)
head(latlong)# A tibble: 6 × 25
Year StateAbbr StateDesc CityName GeographicLevel DataSource Category
<dbl> <chr> <chr> <chr> <chr> <chr> <chr>
1 2017 CA California Hawthorne Census Tract BRFSS Health Outcom…
2 2017 CA California Hawthorne City BRFSS Unhealthy Beh…
3 2017 CA California Hayward City BRFSS Health Outcom…
4 2017 CA California Hayward City BRFSS Unhealthy Beh…
5 2017 CA California Hemet City BRFSS Prevention
6 2017 CA California Indio Census Tract BRFSS Health Outcom…
# ℹ 18 more variables: UniqueID <chr>, Measure <chr>, Data_Value_Unit <chr>,
# DataValueTypeID <chr>, Data_Value_Type <chr>, Data_Value <dbl>,
# Low_Confidence_Limit <dbl>, High_Confidence_Limit <dbl>,
# Data_Value_Footnote_Symbol <chr>, Data_Value_Footnote <chr>,
# PopulationCount <dbl>, lat <dbl>, long <dbl>, CategoryID <chr>,
# MeasureId <chr>, CityFIPS <dbl>, TractFIPS <dbl>, Short_Question_Text <chr>
Filter the dataset
Remove the StateDesc that includes the United Sates, select Prevention as the category (of interest), filter for only measuring crude prevalence and select only 2017.
latlong_clean <- latlong |>
filter(StateDesc != "United States") |>
filter(Category == "Prevention") |>
filter(Data_Value_Type == "Crude prevalence") |>
filter(Year == 2017)
head(latlong_clean)# A tibble: 6 × 25
Year StateAbbr StateDesc CityName GeographicLevel DataSource Category
<dbl> <chr> <chr> <chr> <chr> <chr> <chr>
1 2017 AL Alabama Montgomery City BRFSS Prevention
2 2017 CA California Concord City BRFSS Prevention
3 2017 CA California Concord City BRFSS Prevention
4 2017 CA California Fontana City BRFSS Prevention
5 2017 CA California Richmond Census Tract BRFSS Prevention
6 2017 FL Florida Davie Census Tract BRFSS Prevention
# ℹ 18 more variables: UniqueID <chr>, Measure <chr>, Data_Value_Unit <chr>,
# DataValueTypeID <chr>, Data_Value_Type <chr>, Data_Value <dbl>,
# Low_Confidence_Limit <dbl>, High_Confidence_Limit <dbl>,
# Data_Value_Footnote_Symbol <chr>, Data_Value_Footnote <chr>,
# PopulationCount <dbl>, lat <dbl>, long <dbl>, CategoryID <chr>,
# MeasureId <chr>, CityFIPS <dbl>, TractFIPS <dbl>, Short_Question_Text <chr>
What variables are included? (can any of them be removed?)
names(latlong_clean) [1] "Year" "StateAbbr"
[3] "StateDesc" "CityName"
[5] "GeographicLevel" "DataSource"
[7] "Category" "UniqueID"
[9] "Measure" "Data_Value_Unit"
[11] "DataValueTypeID" "Data_Value_Type"
[13] "Data_Value" "Low_Confidence_Limit"
[15] "High_Confidence_Limit" "Data_Value_Footnote_Symbol"
[17] "Data_Value_Footnote" "PopulationCount"
[19] "lat" "long"
[21] "CategoryID" "MeasureId"
[23] "CityFIPS" "TractFIPS"
[25] "Short_Question_Text"
Remove the variables that will not be used in the assignment
Prevention <- latlong_clean |>
select(-DataSource,-Data_Value_Unit, -DataValueTypeID, -Low_Confidence_Limit, -High_Confidence_Limit, -Data_Value_Footnote_Symbol, -Data_Value_Footnote)
head(Prevention)# A tibble: 6 × 18
Year StateAbbr StateDesc CityName GeographicLevel Category UniqueID Measure
<dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 2017 AL Alabama Montgome… City Prevent… 151000 Choles…
2 2017 CA California Concord City Prevent… 616000 Visits…
3 2017 CA California Concord City Prevent… 616000 Choles…
4 2017 CA California Fontana City Prevent… 624680 Visits…
5 2017 CA California Richmond Census Tract Prevent… 0660620… Choles…
6 2017 FL Florida Davie Census Tract Prevent… 1216475… Choles…
# ℹ 10 more variables: Data_Value_Type <chr>, Data_Value <dbl>,
# PopulationCount <dbl>, lat <dbl>, long <dbl>, CategoryID <chr>,
# MeasureId <chr>, CityFIPS <dbl>, TractFIPS <dbl>, Short_Question_Text <chr>
Tenesse will the first state that I will work on
tn <- Prevention |>
filter(StateAbbr == "TN")
head(tn)# A tibble: 6 × 18
Year StateAbbr StateDesc CityName GeographicLevel Category UniqueID Measure
<dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 2017 TN Tennessee Clarksvil… Census Tract Prevent… 4715160… Choles…
2 2017 TN Tennessee Knoxville City Prevent… 4740000 Choles…
3 2017 TN Tennessee Knoxville Census Tract Prevent… 4740000… Choles…
4 2017 TN Tennessee Memphis Census Tract Prevent… 4748000… Taking…
5 2017 TN Tennessee Memphis Census Tract Prevent… 4748000… Choles…
6 2017 TN Tennessee Memphis Census Tract Prevent… 4748000… Choles…
# ℹ 10 more variables: Data_Value_Type <chr>, Data_Value <dbl>,
# PopulationCount <dbl>, lat <dbl>, long <dbl>, CategoryID <chr>,
# MeasureId <chr>, CityFIPS <dbl>, TractFIPS <dbl>, Short_Question_Text <chr>
1. Filtering the dataset for Blood Pressure Medication in Tenesse in 2017
Health_insurance_tn <- tn |>
filter(Short_Question_Text == "Health Insurance" & PopulationCount>20)
head(Health_insurance_tn)# A tibble: 6 × 18
Year StateAbbr StateDesc CityName GeographicLevel Category UniqueID Measure
<dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 2017 TN Tennessee Clarksvil… Census Tract Prevent… 4715160… "Curre…
2 2017 TN Tennessee Knoxville Census Tract Prevent… 4740000… "Curre…
3 2017 TN Tennessee Clarksvil… Census Tract Prevent… 4715160… "Curre…
4 2017 TN Tennessee Knoxville Census Tract Prevent… 4740000… "Curre…
5 2017 TN Tennessee Knoxville Census Tract Prevent… 4740000… "Curre…
6 2017 TN Tennessee Chattanoo… Census Tract Prevent… 4714000… "Curre…
# ℹ 10 more variables: Data_Value_Type <chr>, Data_Value <dbl>,
# PopulationCount <dbl>, lat <dbl>, long <dbl>, CategoryID <chr>,
# MeasureId <chr>, CityFIPS <dbl>, TractFIPS <dbl>, Short_Question_Text <chr>
2. Based on the GIS tutorial (Japan earthquakes), create one plot about something in my subsetted dataset.
First plot chunk here
library(ggplot2)
ggplot(Health_insurance_tn, aes(x= Data_Value,y= PopulationCount, color= MeasureId))+ geom_point()+ scale_color_brewer()+
scale_y_continuous(limits = c(0, 10000)) +
labs(title = "Health Insurance provided in 2017 in Tenesse",
x= "Health Insurance",
y= "Population Count")+
theme_dark()Warning: Removed 13 rows containing missing values or values outside the scale range
(`geom_point()`).
options(scipen = 999)
Comments :
Upon reviewing the visualization, the lack of health insurance is not a lot , so it becomes apparent that a substantial number of Tenesse residents acquired health insurance in 2017. This year emerges as a significant milestone in the healthcare domain of Tenesse.I believe this development signifies a positive outcome for Tenesse residents. Enhanced health insurance coverage is poised to improve the overall well-being of the population, potentially leading to longer and healthier lives. With expanded access to healthcare services, individuals can expect to receive greater attention and care from doctors and nurses.
3. Now create a map of my dataset.
4. Refine your map to include a mousover tooltip
Refined map chunk here
5 Paragraph :
According to the map, Memphis, one of the largest cities in Tennessee, had the highest percentage of residents who enrolled for health insurance in 2017. This project aimed to provide insights into Tennessee, a city I have never visited. However, it was challenging to find all the relevant information in one place. Exploring the map was intriguing, but it proved to be difficult to navigate and obtain comprehensive information.