knitr::opts_chunk$set( cache = FALSE, collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
kffdata
The R package kffdata
stores a few datasets from the Kaiser Family Foundation in a tidy format. The following
datasets are currently available:
kffdata::hosp_beds kffdata::hosp_admissions kffdata::hosp_em_visits kffdata::hosp_ip_days kffdata::hosp_op_visits kffdata::hc_eee_pc kffdata::hc_eee_pc_by_srvu kffdata::pct_diabetes kffdata::pct_overweight_obesity kffdata::medicaid_chip_enrollment
You can install kffdata
from the Github repo with
# install.packages("remotes") remotes::install_github("jjchern/kffdata@v0.0.2") # To uninstall the package, use: # remove.packages("kffdata")
library(tidyverse) kffdata::hosp_beds kffdata::hosp_admissions kffdata::hosp_em_visits kffdata::hosp_ip_days kffdata::hosp_op_visits kffdata::hc_eee_pc kffdata::hc_eee_pc_by_srvu kffdata::pct_diabetes kffdata::pct_overweight_obesity kffdata::medicaid_chip_enrollment
kffdata::hosp_beds %>% filter(year == 2014) %>% rename(id = fips) %>% right_join(usmapdata::state) -> beds_2014 ggplot() + geom_map(data = beds_2014, map = beds_2014, aes(x = long, y = lat, map_id = id, fill = total), colour = alpha("white", 0.5), size=0.2) + coord_map("albers", lat0 = 30, lat1 = 40) + viridis::scale_fill_viridis(option = "C") + ggtitle("U.S. Hospital Beds per 1,000 Population, 2014") + hrbrthemes::theme_ipsum_ps() + ggthemes::theme_map() + theme(legend.position = c(.85, .3), legend.title=element_blank(), plot.title = element_text(hjust = 0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.