Created
March 5, 2021 00:02
-
-
Save jsfenfen/4163f6d3b3d10f6ad49293bd3f7a9c82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| library(dplyr) | |
| # See https://healthdata.gov/dataset/covid-19-reported-patient-impact-and-hospital-capacity-state-timeseries | |
| fileurl = "https://healthdata.gov/sites/default/files/reported_hospital_utilization_timeseries_20210227_1306.csv" | |
| hospraw <- read.csv(url(fileurl), header=TRUE, sep=",") | |
| # parse the dates | |
| hospraw$dateob = as.Date(hospraw$date) | |
| # Look at every state at once | |
| # Also filter out negative numbers so the scale doesn't get messed up | |
| hospraw %>% filter(previous_day_admission_pediatric_covid_suspected>0) %>% ggplot(aes(x=dateob,y=previous_day_admission_pediatric_covid_suspected)) + geom_line() + facet_wrap( ~ state, scales = "free" ) + xlab("") + xlim(as.Date('2020-07-01'), as.Date('2021-03-01')) | |
| # Look at just OR and WA | |
| hospraw %>% filter(state=="OR" | state=="WA" ) %>% ggplot(aes(x=dateob,y=previous_day_admission_pediatric_covid_suspected, color=state)) + geom_line() + xlab("Date") | |
| # Coverage of pediatric suspected is not the cause of this anomaly | |
| hospraw %>% filter(previous_day_admission_pediatric_covid_suspected_coverage>0) %>% ggplot(aes(x=dateob,y=previous_day_admission_pediatric_covid_suspected_coverage)) + geom_line() + facet_wrap( ~ state, scales = "free" ) + xlab("Date") + xlim(as.Date('2020-07-01'), as.Date('2021-03-01')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment