Healthcare Cost Report Information System (‘cost reports’)
Let’s work with the HCRIS GitHub repository.
hcris.data %>% group_by(year) %>%
filter(price_denom>10, !is.na(price_denom),
price_num>0, !is.na(price_num)) %>%
select(price, year) %>%
summarize(mean_price=mean(price, na.rm=TRUE)) %>%
ggplot(aes(x=as.factor(year), y=mean_price)) +
geom_line(aes(group=1)) +
labs(
x="Year",
y="Average Hospital Price",
title="Hospital Prices per Year"
) + scale_y_continuous(labels=comma) +
theme_bw() + theme(axis.text.x = element_text(angle = 90, hjust=1))
hcris.data %>% group_by(year) %>%
filter(price_denom>100, !is.na(price_denom),
price_num>0, !is.na(price_num),
price<100000) %>% #<<
select(price, year) %>%
summarize(mean_price=mean(price, na.rm=TRUE)) %>%
ggplot(aes(x=as.factor(year), y=mean_price)) +
geom_line(aes(group=1)) +
labs(
x="Year",
y="Average Hospital Price",
title="Hospital Prices per Year"
) + scale_y_continuous(labels=comma) +
theme_bw() + theme(axis.text.x = element_text(angle = 90, hjust=1))