Skip to content

Instantly share code, notes, and snippets.

@benzipperer
Last active July 6, 2023 18:04
Show Gist options
  • Save benzipperer/47d91c9f85ba154d25f14d44d459a598 to your computer and use it in GitHub Desktop.
Save benzipperer/47d91c9f85ba154d25f14d44d459a598 to your computer and use it in GitHub Desktop.
distribution of facility-level staffing ratios, by Census Region, June 2023
library(tidyverse)
library(ggridges)
# state codes
states_regions <- read_csv("https://raw.githubusercontent.com/cphalpert/census-regions/master/us%20census%20bureau%20regions%20and%20divisions.csv") %>%
select(state_abb = `State Code`, region = Region)
# CMS provider info
# https://data.cms.gov/provider-data/dataset/4pq5-n9py
raw <- read_csv("NH_ProviderInfo_Jun2023.csv") %>%
rename(
staff_ratio = `Adjusted Total Nurse Staffing Hours per Resident per Day`,
state_abb = State
) %>%
full_join(states_regions, by = "state_abb")
# draw a picture
my_palette <- viridisLite::viridis(7)
raw %>%
filter(!is.na(region)) %>%
ggplot() +
geom_density_ridges(
aes(x = staff_ratio, y = region, fill = region),
color = "white"
) +
scale_fill_manual(values = alpha(c(my_palette[1:4]), 0.7)) +
guides(fill = "none") +
hrbrthemes::theme_ipsum() +
labs(
x = "Total nurse hours per resident per day",
y = NULL,
title = "Distribution of facility-level staffing ratios, by Census region, June 2023"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment