Calculating Counts of Composite Estimates for Vision Impairment and Blindness by State

Read in the data and explore variables.

setwd("C:/Users/yxj4/Desktop/Composite Estimates")
library(data.table)
vi <- read.csv("VEHSS_Prevalence_Estimates_-_Visual_Acuity_Loss.csv", header = TRUE, sep = ",", na.strings = "")
vi_dt <- data.table(vi)

Create a dataset with only one row per state.

vi_small <- vi_dt[Age == "All ages" & Gender== "All genders" & RaceEthnicity == "All races" & Response == "Any vision loss" & RiskFactorResponse == "Total" & GeographicLevel == "State" & Question == "Prevalence of Vision Loss, by major age groups",]
vi_small <- vi_small[order(LocationDesc),]

Total number of people in the US with VI or blindness.

totalUS <- sum(vi_small$Numerator)
totalUS
## [1] 7078737

Count of VI or Blindness by State

vi_small[Age == "All ages" & Gender== "All genders" & RaceEthnicity == "All races" & Response == "Any vision loss" & RiskFactorResponse == "Total" & GeographicLevel == "State" & Question == "Prevalence of Vision Loss, by major age groups",list(LocationDesc,Numerator)]
##             LocationDesc Numerator
##  1:              Alabama    131226
##  2:               Alaska     12269
##  3:              Arizona     89311
##  4:             Arkansas    160264
##  5:           California    810883
##  6:             Colorado     98968
##  7:          Connecticut     62330
##  8:             Delaware     18115
##  9: District Of Columbia     22377
## 10:              Florida    558645
## 11:              Georgia    221276
## 12:               Hawaii     30230
## 13:                Idaho     37004
## 14:             Illinois    244870
## 15:              Indiana    141921
## 16:                 Iowa     47986
## 17:               Kansas     62990
## 18:             Kentucky    125300
## 19:            Louisiana    123032
## 20:                Maine     17996
## 21:             Maryland    102839
## 22:        Massachusetts    129600
## 23:             Michigan    200709
## 24:            Minnesota     92520
## 25:          Mississippi     98273
## 26:             Missouri    138026
## 27:              Montana     19124
## 28:             Nebraska     40633
## 29:               Nevada     80274
## 30:        New Hampshire     23460
## 31:           New Jersey    169010
## 32:           New Mexico     62255
## 33:             New York    393190
## 34:       North Carolina    230821
## 35:         North Dakota     12114
## 36:                 Ohio    251194
## 37:             Oklahoma    116427
## 38:               Oregon     78853
## 39:         Pennsylvania    302613
## 40:         Rhode Island     21486
## 41:       South Carolina    129785
## 42:         South Dakota     15976
## 43:            Tennessee    172343
## 44:                Texas    633980
## 45:                 Utah     43018
## 46:              Vermont     13883
## 47:             Virginia    168059
## 48:           Washington    144167
## 49:        West Virginia     65241
## 50:            Wisconsin    101624
## 51:              Wyoming     10247
##             LocationDesc Numerator