countyhealth19 | R Documentation |
This data set provides a variety of health indicators for each US county. The data vector colfullnames19 contains longer descriptive names of the fields than the data frame column names, such as "Poor or fair health raw value" instead of "v002_rawvalue"
data('countyhealth19')
A data.frame with >3000 rows (Counties but also State and US totals) and >500 columns (variables). For 2019, 3194 obs. of 534 variables.
2014 - 2019 datasets from http://www.countyhealthrankings.org/explore-health-rankings/rankings-data-documentation
e.g.,
utils::browseURL('http://www.countyhealthrankings.org/rankings/data')
or
fname <- 'analytic_data2019_0.csv'
utils::download.file(url = paste('http://www.countyhealthrankings.org/sites/default/files/', fname, sep = ”), destfile = fname)
### maybe better to use readr::read_csv() since it is better at guessing preferred format of each column
countyhealth19 <- utils::read.csv(fname, stringsAsFactors = FALSE)
require(readr)
countyhealth19 <- readr::read_csv(fname, skip = 1, col_types = paste('ccccc', paste(rep('d',534-5), collapse = ”), sep = ”))
countyhealth19 <- as.data.frame(countyhealth19)
colfullnames19 <- readr::read_csv(fname, n_max = 1, col_names = FALSE)
colfullnames19 <- as.vector(unlist(colfullnames19)) # simpler
countyhealth19[1:5, 1:9]
save(countyhealth19, file = 'countyhealth19.RData')
save(colfullnames19, file = 'colfullnames19.RData')
2014/2015 data obtained 3/27/2015 and slightly modified to provide
5 digit FIPS as character field, and ST field as copy of State field.
The 2016 data was obtained 3/17/2016 and was not modified
The 2017 data was obtained 3/28/2018
The 2018 data was obtained 3/28/2018
The 2019 data was obtained 4/22/2019
Also see: http://www.countyhealthrankings.org/about-us
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.