This is a summary from hospital complications from https://data.medicare.gov/data/hospital-compare

Hospitals in Louisville which are below national average

compl %>% 
  filter(City=="LOUISVILLE" & `Compared to National`=="Worse than the National Rate") %>% 
  select(`Hospital Name`, `Measure Name`, `Compared to National`) %>% 
  datatable

Hospitals in Louisville which are better than national average

compl %>% 
  filter(City=="LOUISVILLE" & `Compared to National`=="Better than the National Rate") %>% 
  select(`Hospital Name`, `Measure Name`, `Compared to National`) %>% 
  datatable


How do the hospital do when compared to national average

compl$`Compared to National` %>% 
  table %>% 
  prop.table
## .
##                       Not Available       Better than the National Rate 
##                        0.0001833685                        0.0136915131 
## No different than the National Rate                       Not Available 
##                        0.5744628832                        0.3220561719 
##           Number of Cases Too Small        Worse than the National Rate 
##                        0.0663793894                        0.0232266740

Hospital-associated infections in Louisville(worse than the national benchmark)

setwd("C:/Users/Pranay/Downloads")
hai<-read_csv('healthcareassociatedinfections.csv')
hai %>% 
    filter(City=="LOUISVILLE" & `Compared to National`=="Worse than the National Benchmark")%>%     select(`Hospital Name`, `Measure Name`, `Compared to National`) %>% 
    datatable