knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The hospitals
package contains hospital related data.
So far it contains the following dataset(s):
hospitals::beds_state
: State-year level hospital beds per 1,000 population. Source: Hospital Beds per 1,000 Population by Ownership Type, 1999--2014# install.packages("devtools") devtools::install_github("jjchern/hospitals") # To uninstall the package, use: # remove.packages("hospitals")
library(dplyr, warn.conflicts = FALSE) hospitals::beds_state hospitals::beds_state %>% filter(year == 2014) %>% mutate(fips = sprintf("%02d", fips)) -> beds_2014 beds_2014 usmapdata::state %>% left_join(beds_2014, by = c("id" = "fips")) -> beds_2014 library(ggplot2) 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 = "A") + ggtitle("U.S. Hospital Beds per 1,000 Population, 2014") + ggthemes::theme_map() + theme(legend.position = c(.85, .3), legend.title=element_blank())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.