package 'leaflet' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\kwils\AppData\Local\Temp\RtmpmOYJfH\downloaded_packages
install.packages("sf")
package 'sf' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\kwils\AppData\Local\Temp\RtmpmOYJfH\downloaded_packages
# 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 <chr>, long <chr>, 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.
# 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>
For your assignment, work with the cleaned “Prevention” dataset
1. Once you run the above code, filter this dataset one more time for any particular subset.
Filter chunk here
#extracting data related to Montgomery, AlabamaALA_data <- prevention |>filter(!is.na(Data_Value), StateDesc =="Alabama", CityName =="Montgomery")head(ALA_data)
# A tibble: 6 × 18
Year StateAbbr StateDesc CityName GeographicLevel Category UniqueID Measure
<dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 2017 AL Alabama Montgomery City Prevent… 151000 Choles…
2 2017 AL Alabama Montgomery Census Tract Prevent… 0151000… Taking…
3 2017 AL Alabama Montgomery Census Tract Prevent… 0151000… Choles…
4 2017 AL Alabama Montgomery Census Tract Prevent… 0151000… Visits…
5 2017 AL Alabama Montgomery Census Tract Prevent… 0151000… Visits…
6 2017 AL Alabama Montgomery City Prevent… 151000 Visits…
# ℹ 10 more variables: Data_Value_Type <chr>, Data_Value <dbl>,
# PopulationCount <dbl>, lat <chr>, long <chr>, 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 your subsetted dataset.
First plot chunk here
#scatter plotggplot(ALA_data, aes(x = MeasureId, y = Data_Value, color = MeasureId)) +geom_point() +geom_jitter() +labs(title ="Preventive Measures in Montgomery, Alabama ",x ="Measure ID",y ="Data Value",color ="Measure",caption ="Data from 2017, Source: CDC") +scale_color_brewer(palette ="Spectral") +theme_bw() +theme(axis.text.x =element_text(angle =45, vjust =1, hjust=1))
leaflet(data = AL_data) |>addTiles() |>addCircles(lng =~long, lat =~lat, popup = AL_popup) |>setView(lng = AL_lon, lat = AL_lat, zoom =6)
5. Write a paragraph
The initial scatterplot provides an in-depth look at Montgomery, Alabama’s efforts in preventive healthcare. It focuses on key factors like access to healthcare services, blood pressure medication adherence, regular checkups, and cholesterol screening. This visual representation helps to understand how these health measures are distributed throughout the city.
Following this analysis, we have a map showcasing Montgomery, Alabama. It not only outlines the city’s boundaries but also provides important demographic data. This includes the city’s population and the percentage of people taking blood pressure medication. Together, these visuals give us a clearer picture of Montgomery’s health landscape.