library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.2.2
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ tibble  3.1.8     ✔ purrr   0.3.5
## ✔ tidyr   1.2.1     ✔ stringr 1.4.1
## ✔ readr   2.1.3     ✔ forcats 0.5.2
## Warning: package 'forcats' was built under R version 4.2.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.2.2
library(treemap)
## Warning: package 'treemap' was built under R version 4.2.2
library(readr)
chart_data <- read_csv("chart_data.csv")
## Rows: 6 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Race
## dbl (1): Infant mortality rate per 1000 live births
## 
## ℹ 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.
View(chart_data)

Introduce National Data

IMUSA <- chart_data %>%
  select(Race, `Infant mortality rate per 1000 live births`)

IMUSA
## # A tibble: 6 × 2
##   Race                                                   Infant mortality rate…¹
##   <chr>                                                                    <dbl>
## 1 Non-Hispanic Black                                                        10.6
## 2 Non-Hispanic Native Hawaiian or other Pacific Islander                     8.2
## 3 Non-Hispanic American Indian or Alaska Native                              7.9
## 4 Hispanic                                                                   5  
## 5 Non-Hispanic White                                                         4.5
## 6 Non-Hispanic Asian                                                         3.4
## # … with abbreviated variable name
## #   ¹​`Infant mortality rate per 1000 live births`

!!! CREATE A CHART !!!!


library(readr)
states<- read_csv("statesdata.csv")
## Rows: 400 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): STATE, RATE, URL
## dbl (2): YEAR, DEATHS
## 
## ℹ 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.
states
## # A tibble: 400 × 5
##     YEAR STATE RATE  DEATHS URL                                      
##    <dbl> <chr> <chr>  <dbl> <chr>                                    
##  1  2020 AL    6.99     403 /nchs/pressroom/states/alabama/al.htm    
##  2  2020 AK    5.07      48 /nchs/pressroom/states/alaska/ak.htm     
##  3  2020 AZ    5.19     399 /nchs/pressroom/states/arizona/az.htm    
##  4  2020 AR    7.38     260 /nchs/pressroom/states/arkansas/ar.htm   
##  5  2020 CA    3.92    1648 /nchs/pressroom/states/california/ca.htm 
##  6  2020 CO    4.8      295 /nchs/pressroom/states/colorado/co.htm   
##  7  2020 CT    4.33     145 /nchs/pressroom/states/connecticut/ct.htm
##  8  2020 DE    5.1       53 /nchs/pressroom/states/delaware/de.htm   
##  9  2020 FL    5.8     1217 /nchs/pressroom/states/florida/fl.htm    
## 10  2020 GA    6.28     769 /nchs/pressroom/states/georgia/ga.htm    
## # … with 390 more rows

PULL OUT THE REGION & CREATE A REGIONAL COMPARISION

DC 4.5 (infant deaths per 1,000 live births) - not included in CDC CVS MD, VA, DE, WV

State_side <- states %>%
  select(STATE, RATE, YEAR, DEATHS) %>%
  filter(STATE %in% c("MD", "DE", "VA", "WV")) %>%
  filter(YEAR > 2019) %>%
  group_by(STATE)

State_side
## # A tibble: 4 × 4
## # Groups:   STATE [4]
##   STATE RATE   YEAR DEATHS
##   <chr> <chr> <dbl>  <dbl>
## 1 DE    5.1    2020     53
## 2 MD    5.73   2020    393
## 3 VA    5.76   2020    546
## 4 WV    7.33   2020    127
State_sidemap <- treemap(State_side,
        index=c("STATE","RATE"),
    vSize = "DEATHS",
        type="index",
        palette = "PuRd",
        title="Regional Comparison: Maryland, Virginia, Delaware, West Virginia",
        fontsize.title = 7,
        border.col= "Gold"
)

State_sidemap
## $tm
##   STATE RATE vSize vColor stdErr vColorValue level        x0        y0
## 1    DE  5.1    53      1     53          NA     2 0.8492255 0.0000000
## 2    DE <NA>    53      1     53          NA     1 0.8492255 0.0000000
## 3    MD 5.73   393      1    393          NA     2 0.4879357 0.3141361
## 4    MD <NA>   393      1    393          NA     1 0.4879357 0.3141361
## 5    VA 5.76   546      1    546          NA     2 0.0000000 0.0000000
## 6    VA <NA>   546      1    546          NA     1 0.0000000 0.0000000
## 7    WV 7.33   127      1    127          NA     2 0.4879357 0.0000000
## 8    WV <NA>   127      1    127          NA     1 0.4879357 0.0000000
##           w         h   color
## 1 0.1507745 0.3141361 #F7F4F9
## 2 0.1507745 0.3141361 #F7F4F9
## 3 0.5120643 0.6858639 #E7E1EF
## 4 0.5120643 0.6858639 #E7E1EF
## 5 0.4879357 1.0000000 #D4B9DA
## 6 0.4879357 1.0000000 #D4B9DA
## 7 0.3612898 0.3141361 #C994C7
## 8 0.3612898 0.3141361 #C994C7
## 
## $type
## [1] "index"
## 
## $vSize
## [1] "DEATHS"
## 
## $vColor
## [1] NA
## 
## $stdErr
## [1] "DEATHS"
## 
## $algorithm
## [1] "pivotSize"
## 
## $vpCoorX
## [1] 0.02812148 0.97187852
## 
## $vpCoorY
## [1] 0.01968504 0.94531496
## 
## $aspRatio
## [1] 1.427417
## 
## $range
## [1] NA
## 
## $mapping
## [1] NA NA NA
## 
## $draw
## [1] TRUE

Create a CHART !!!!!

MARYLAND !!!

Maryland <- states %>%
  select(STATE, RATE, YEAR, DEATHS) %>%
  filter(STATE %in% c("MD")) %>%
  filter(YEAR > 2015) %>%
  group_by(YEAR)

Maryland
## # A tibble: 5 × 4
## # Groups:   YEAR [5]
##   STATE RATE   YEAR DEATHS
##   <chr> <chr> <dbl>  <dbl>
## 1 MD    5.73   2020    393
## 2 MD    5.84   2019    410
## 3 MD    6.02   2018    428
## 4 MD    6.43   2017    461
## 5 MD    6.54   2016    478
MarylandMap <- ggplot(Maryland, aes(x=YEAR, y=RATE, group= STATE, color= DEATHS)) +
  labs(title= "Infant Mortality Rate Amongst Maryland Infants") +
  xlab("Years 2016 - 2020")+
  ylab("Infant Mortality Rate") +
  theme_minimal(base_size = 12) +
  
  geom_line()

MarylandMap

Where is Montgomery County Rates? [Insert Public Health Report Infomration on Montgomery County about Infant Mortality Rates] [Begin to Explore the Leading Causes of Death for Infants in Montgomery County for Each Race variable]

[Introduce Country Hospital, Resource Centers, and Maps]

library(readr)
HospitalsMC<- read_csv("Hospitals_Map.csv")
## Rows: 15 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): NAME, ADDRESS, CITY, PHONE, URL, IN COUNTY, LOCATION
## dbl (3): ZIP CODE, LONGITUDE, LATITUDE
## 
## ℹ 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.
View(HospitalsMC)
HospitalsMC
## # A tibble: 15 × 10
##    NAME        ADDRESS CITY  ZIP C…¹ PHONE URL   IN CO…² LONGI…³ LATIT…⁴ LOCAT…⁵
##    <chr>       <chr>   <chr>   <dbl> <chr> <chr> <chr>     <dbl>   <dbl> <chr>  
##  1 Washington… 7600 C… Tako…   20912 301-… http… In-Cou…   -77.0    39.0 POINT …
##  2 Suburban H… 8600 O… Beth…   20814 301-… http… In-Cou…   -77.1    39.0 POINT …
##  3 National I… 9000 R… Beth…   20892 301-… http… In-Cou…   -77.1    39.0 POINT …
##  4 Walter Ree… 8901 R… Beth…   20889 301-… http… In-Cou…   -77.1    39.0 POINT …
##  5 Holy Cross… 1500 F… Silv…   20910 301-… http… In-Cou…   -77.0    39.0 POINT …
##  6 Laurel Reg… 7300 V… Laur…   20707 301-… http… Out-of…   -76.9    39.1 POINT …
##  7 Shady Grov… 9901 M… Rock…   20850 240-… http… In-Cou…   -77.2    39.1 POINT …
##  8 Montgomery… 18101 … Olney   20832 301-… http… In-Cou…   -77.1    39.2 POINT …
##  9 Germantown… 19731 … Germ…   20874 301-… http… In-Cou…   -77.3    39.2 POINT …
## 10 Frederick … 400 W … Fred…   21701 240-… http… Out-of…   -77.4    39.4 POINT …
## 11 Howard Cou… 5755 C… Colu…   21044 410-… http… Out-of…   -76.9    39.2 POINT …
## 12 Sibley Mem… 5255 L… Wash…   20016 202-… http… Out-of…   -77.1    38.9 POINT …
## 13 Washington… 110 Ir… Wash…   20010 202-… http… Out-of…   -77.0    38.9 POINT …
## 14 Inova Fair… 3300 G… Fall…   22042 703-… http… Out-of…   -77.2    38.9 POINT …
## 15 Childrens … 111 Mi… Wash…   20010 202-… http… Out-of…   -77.0    38.9 POINT …
## # … with abbreviated variable names ¹​`ZIP CODE`, ²​`IN COUNTY`, ³​LONGITUDE,
## #   ⁴​LATITUDE, ⁵​LOCATION
HMC1 <- HospitalsMC %>%
  select()

CREATE MAP !!!!

HMCMap <- leaflet() %>%
  addTiles() %>%
  addMarkers(data = HospitalsMC, lng= HospitalsMC$LONGITUDE, lat= HospitalsMC$LATITUDE, popup = HospitalsMC$NAME)

HMCMap

[Resource Center]

library(readr)
HHSF <- read_csv("Health_and_Human_Services_Facilities_List.csv")
## Rows: 135 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (9): Building Name, Program Name, Phone Number, 24 Hour Emergency Phone ...
## dbl (2): Street Number, Zip
## 
## ℹ 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.
(HHSF)
## # A tibble: 135 × 11
##    Buildin…¹ Progr…² Phone…³ 24 Ho…⁴ Days …⁵ Hours…⁶ Stree…⁷ Stree…⁸   Zip Link 
##    <chr>     <chr>   <chr>   <chr>   <chr>   <chr>     <dbl> <chr>   <dbl> <chr>
##  1 Communit… Mental… 240-77… <NA>    Monday… 8:30 A…      NA <NA>       NA http…
##  2 Delivere… LOCATE… 877-26… <NA>    Monday… 8:30 A…      NA <NA>       NA http…
##  3 MidCount… Rental… 240-77… <NA>    Monday… 8:30 A…    1301 Piccar… 20850 http…
##  4 DHHS Off… ChildL… 240-77… <NA>    Monday… 8:00 A…    1401 Rockvi… 20852 http…
##  5 DHHS Col… Africa… 240-77… <NA>    Monday… 9:00 A…   14015 New Ha… 20904 http…
##  6 MidCount… Emerge… 240-77… <NA>    Monday… 8:30 A…    1301 Piccar… 20850 http…
##  7 UpCounty… Dental… 240-77… <NA>    Monday… 7:45 A…   12900 Middle… 20874 http…
##  8 DHHS Adm… Senior… 240-77… <NA>    Monday… 8:30 A…     401 Hunger… 20850 http…
##  9 MidCount… Mobile… 240-77… <NA>    Monday… 12:00 …    1301 Piccar… 20850 http…
## 10 Based in… Linkag… 240-77… <NA>    Monday… 8:00 A…    1401 Rockvi… 20852 http…
## # … with 125 more rows, 1 more variable: `New Georeferenced Column` <chr>, and
## #   abbreviated variable names ¹​`Building Name`, ²​`Program Name`,
## #   ³​`Phone Number`, ⁴​`24 Hour Emergency Phone Number`, ⁵​`Days of Operation`,
## #   ⁶​`Hours of Operation`, ⁷​`Street Number`, ⁸​`Street Name`

[Introduce MARIA]


[EXTRA] Create Infant Mortality Chart + Map for Baltimore City [This is what I would have wanted to do for Montgomery County if I was given access to the raw dataset similar to the Baltimore City dataset]

library(readr)
Baltimore <- read_csv("Infant_Mortality_Rate.csv")
## Rows: 55 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (1): CSA2010
## dbl (11): OBJECTID, mort1_11, mort1_12, mort1_13, mort1_14, mort1_15, mort1_...
## 
## ℹ 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.
View(Baltimore)