Exploring health state in US, using a dataset from Health Data 2016

Importing and reading data from Social Explorer

library(readr)
health<-read_csv("C:/Users/Marcy/Documents/soc 712/health7.csv")
Parsed with column specification:
cols(
  .default = col_double(),
  `Name of Area` = col_character(),
  `Qualifying Name` = col_character(),
  Diabetics = col_logical()
)
See spec(...) for full column specifications.
head(health)

Viewing variables, removing variables and creating new variable by adding total mental and physical unhealthy days per month.

head(health)
names(health)
 [1] "FIPS"                                                                                
 [2] "Name of Area"                                                                        
 [3] "Qualifying Name"                                                                     
 [4] "State"                                                                               
 [5] "County"                                                                              
 [6] "Physically Unhealthy Days per Month (Persons 18 Years and Over)"                     
 [7] "Mentally Unhealthy Days per Month (Persons 18 Years and Over)"                       
 [8] "Percent of Adults That Report Fair or Poor Health (Persons 18 Years and Over)"       
 [9] "Percent of Low Birthweight Births (<2.5kg)"                                          
[10] "Low Birthweight Births (<2.5kg)"                                                     
[11] "Primary Care Physicians (PCP)"                                                       
[12] "Mental Health Providers (MHP)"                                                       
[13] "Dentists"                                                                            
[14] "Primary Care Physicians (PCP) Rate per 100,000 Population"                           
[15] "Mental Health Providers (MHP) Rate per 100,000 Population"                           
[16] "Dentists Rate per 100,000 Population"                                                
[17] "Health Care Costs Price-adjusted Medicare Reimbursements"                            
[18] "Percent of Persons Without Insurance (Population Under 19 Years, 2013 est.)"         
[19] "Percent of Persons Without Insurance (Population 18 to 64 Years, 2013 est.)"         
[20] "Percent of Persons Without Insurance (Population Under 65 Years, 2013 est.)"         
[21] "Persons Without Insurance (Population Under 19 Years, 2013 est.)"                    
[22] "Persons Without Insurance (Population 18 to 64 Years, 2013 est.)"                    
[23] "Persons Without Insurance (Population Under 65 Years, 2013 est.)"                    
[24] "Premature Deaths (Less than 75 Years)"                                               
[25] "Years of Potential Life Lost (YPLL) Rate per 100,000 Population (Less than 75 Years)"
[26] "Infant Mortality (Death Counts)"                                                     
[27] "Child Mortality (Death Counts)"                                                      
[28] "Premature Age-adjusted Mortality (Death Counts)"                                     
[29] "Drug Poisoning Mortality (Death Counts)"                                             
[30] "Infant Mortality Rate per 1,000 Live Births"                                         
[31] "Child Mortality Rate per 1,000 Population"                                           
[32] "Premature Age-adjusted Mortality Rate per 100,000 Population"                        
[33] "Drug Poisoning Mortality Rate per 100,000 Population"                                
[34] "Percent Diabetics (Adults)"                                                          
[35] "Percent of Diabetic Medicare Enrollees Receiving Hba1c Test"                         
[36] "Diabetics"                                                                           
[37] "Diabetic Medicare Enrollees (Out of Total Medicare Enrolles)"                        
[38] "Teen Birth Count (Females 15 to 19 Years)"                                           
[39] "Chlamydia Cases (Count)"                                                             
[40] "HIV Prevalence (Count)"                                                              
[41] "Teen Births Rate per 100,000 Population (Females 15 to 19 Years)"                    
[42] "Chlamydia Cases Rate per 100,000 Population"                                         
[43] "HIV Prevalence Rate per 100,000 Population"                                          
[44] "Percent Current Smokers (Persons 18 Years and Over)"                                 
[45] "Percent Drinking Adults (Persons 18 Years and Over)"                                 
[46] "Percent of Persons with Limited Access to Healthy Foods"                             
[47] "Percent of Persons with Access to Exercise Opportunities"                            
[48] "Percent Obese Persons (20 Years and Over)"                                           
[49] "Percent Percent Physically Inactive Persons (20 Years and Over)"                     
[50] "Percent of Children Eligible for Free Lunch (Persons < 18 Years)"                    
[51] "Food Environment Index"                                                              
new_health<-select(health, "Qualifying Name" : "Dentists Rate per 100,000 Population","Percent Drinking Adults (Persons 18 Years and Over)" )
names(new_health)
 [1] "Qualifying Name"                                                              
 [2] "State"                                                                        
 [3] "County"                                                                       
 [4] "Physically Unhealthy Days per Month (Persons 18 Years and Over)"              
 [5] "Mentally Unhealthy Days per Month (Persons 18 Years and Over)"                
 [6] "Percent of Adults That Report Fair or Poor Health (Persons 18 Years and Over)"
 [7] "Percent of Low Birthweight Births (<2.5kg)"                                   
 [8] "Low Birthweight Births (<2.5kg)"                                              
 [9] "Primary Care Physicians (PCP)"                                                
[10] "Mental Health Providers (MHP)"                                                
[11] "Dentists"                                                                     
[12] "Primary Care Physicians (PCP) Rate per 100,000 Population"                    
[13] "Mental Health Providers (MHP) Rate per 100,000 Population"                    
[14] "Dentists Rate per 100,000 Population"                                         
[15] "Percent Drinking Adults (Persons 18 Years and Over)"                          
library(dplyr)
total_health<- new_health %>% mutate("Total Unhealthy" = `Physically Unhealthy Days per Month (Persons 18 Years and Over)` + `Mentally Unhealthy Days per Month (Persons 18 Years and Over)`)
names(total_health)
 [1] "Qualifying Name"                                                              
 [2] "State"                                                                        
 [3] "County"                                                                       
 [4] "Physically Unhealthy Days per Month (Persons 18 Years and Over)"              
 [5] "Mentally Unhealthy Days per Month (Persons 18 Years and Over)"                
 [6] "Percent of Adults That Report Fair or Poor Health (Persons 18 Years and Over)"
 [7] "Percent of Low Birthweight Births (<2.5kg)"                                   
 [8] "Low Birthweight Births (<2.5kg)"                                              
 [9] "Primary Care Physicians (PCP)"                                                
[10] "Mental Health Providers (MHP)"                                                
[11] "Dentists"                                                                     
[12] "Primary Care Physicians (PCP) Rate per 100,000 Population"                    
[13] "Mental Health Providers (MHP) Rate per 100,000 Population"                    
[14] "Dentists Rate per 100,000 Population"                                         
[15] "Percent Drinking Adults (Persons 18 Years and Over)"                          
[16] "Total Unhealthy"                                                              

Summary

Summarizing “Total Unhealthy” and “Qualifying Name” variables and filtering out missing NA values as well.

Summ_unhealthy<- total_health %>% filter(!is.na(`Total Unhealthy`)) %>%
                          group_by(`Qualifying Name`)  %>%
                                summarise(total_unhealth = sum(`Total Unhealthy`))
Summ_unhealthy

Plotting

Creating a plot to see if there is any correlation between % of drinking adults and total number of reported unhealthy days per month.

ggplot(data=total_health, aes(x=`Percent Drinking Adults (Persons 18 Years and Over)`,
                        y=`Total Unhealthy`)) +
  geom_bar(stat="identity",fill="darkorange1") + ggtitle("Data distribution of Drinking Adults (%) and reporting of feeling unhealthy")

NA
LS0tDQp0aXRsZTogIkhvbWV3b3JrIDIiDQpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sNCi0tLQ0KDQojIyAqRXhwbG9yaW5nIGhlYWx0aCBz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