Rows: 810103 Columns: 24
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (17): StateAbbr, StateDesc, CityName, GeographicLevel, DataSource, Categ...
dbl (6): Year, Data_Value, Low_Confidence_Limit, High_Confidence_Limit, Cit...
num (1): PopulationCount
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
The GeoLocation variable has (lat, long) format
Split GeoLocation (lat, long) into two columns: lat and long
# 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.
2. Based on the GIS tutorial (Japan earthquakes), create one plot about something in your subsetted dataset.
ggplot(No_health_SC, aes(Data_Value, PopulationCount, color = CityName)) +geom_point()+labs(title="Percent of Adults Aged 18-64 Years Without Health Insurance in South Carolina",x="Percentage Prevalence of Adults 18-64 Without Health Insurance(%)",y ="Population",color ="Cities in SC")
3. Now create a map of your subsetted dataset.
library(leaflet)
Warning: package 'leaflet' was built under R version 4.3.3
library(sf)
Warning: package 'sf' was built under R version 4.3.3
Linking to GEOS 3.11.2, GDAL 3.8.2, PROJ 9.3.1; sf_use_s2() is TRUE
Assuming "long" and "lat" are longitude and latitude, respectively
5. Write a paragraph
I made the plot and the map to see where in South Carolina has the most adults without health insurance. We can see that Charleston has the most adults without health insurance in South Carolina. The map does a better job than my scatterplot to show which cities have the most adults without health insurance. Thescatter plot I use to see if there is a trend with more people in a population than more adults without health insurance. However, this trend wasn’t shown in my scatter plots because a lot of low populations had high prevalnce of adults. I really like how leaflet works because mapping is very important and this package makes it easy even though I did have that problem with the popups not working at the start. The other part that was slightly diffcult was selecting the information for the popups. In my map , I use only the most important three to show. Thank you for this tutorial using leafelt it was very easy to follow and easy to understand.