knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-",
  message = FALSE, 
  warning = FALSE,
  cache = TRUE
)

About

Travis-CI Build Status AppVeyor Build Status

This repo contains R scripts (in the data-raw folder) that download county-level and state-level Area Health Resources Files (AHRF). The datasets are stored in the data folder.

AHRF is issued annually. The most recent release is in 2016 (as of July 24, 2017).

For more information on the AHRF files, see https://datawarehouse.hrsa.gov/topics/ahrf.aspx.

Installation

You can also download the datasets as an R package. The size of ahrf_county.rda is 17.5M, so it might take a while to install and load into memory.

# install.packages("devtools")
devtools::install_github("jjchern/ahrf@v0.0.1")

# To uninstall the package, use:
# remove.packages("ahrf")

Usage

Load the state file

library(tidyverse)
ahrf::ahrf_state

There're 3230 rows and 6921 columns in the county file (wide format)

dim(ahrf::ahrf_county)

Variable labels are included

library(labelled)
ahrf::ahrf_county %>% 
        select(F04437, F00002, contains("F08921"), contains("F11984")) %>% 
        var_label() %>% 
        enframe() %>% 
        unnest()

County-level hospital beds in 2013

ahrf::ahrf_county %>% 
        select(county = F04437, 
               fips = F00002, 
               beds_2013 = `F08921-13`,
               pop_2013 = `F11984-13`) %>% 
        mutate(beds_2013 = as.integer(beds_2013),
               pop_2013 = as.integer(pop_2013),
               beds_2013_p10k = beds_2013 / pop_2013 * 10000) -> beds
beds

lapply(beds, summary)


jjchern/ahrf documentation built on May 19, 2019, 11:38 a.m.