View source: R/cdc_aggregated_projections.R
| cdc_aggregated_projections | R Documentation | 
The US CDC gathers projections from several groups around the world and aggregates them into a single data resource. See the reference below for details of the models.
cdc_aggregated_projections()
These models are not updated daily but more like weekly. This function will attempt to grab the latest version.
a data.frame
Sean Davis seandavi@gmail.com
Other data-import: 
acaps_government_measures_data(),
acaps_secondary_impact_data(),
apple_mobility_data(),
beoutbreakprepared_data(),
cci_us_vaccine_data(),
cdc_excess_deaths(),
cdc_social_vulnerability_index(),
coronadatascraper_data(),
coronanet_government_response_data(),
cov_glue_lineage_data(),
cov_glue_newick_data(),
cov_glue_snp_lineage(),
covidtracker_data(),
descartes_mobility_data(),
ecdc_data(),
econ_tracker_consumer_spending,
econ_tracker_employment,
econ_tracker_unemp_data,
economist_excess_deaths(),
financial_times_excess_deaths(),
google_mobility_data(),
government_policy_timeline(),
jhu_data(),
jhu_us_data(),
kff_icu_beds(),
nytimes_county_data(),
oecd_unemployment_data(),
owid_data(),
param_estimates_published(),
test_and_trace_data(),
us_county_geo_details(),
us_county_health_rankings(),
us_healthcare_capacity(),
us_hospital_details(),
us_state_distancing_policy(),
usa_facts_data(),
who_cases()
res = cdc_aggregated_projections()
head(res)
dplyr::glimpse(res)
# available models
table(res$model)
# projection targets
table(res$target)
min(res$forecast_date)
max(res$target_week_end_date)
library(dplyr)
library(ggplot2)
# FACET view
res_ny = res %>%
    dplyr::filter(location_name=='New York' & grepl('cum death', target)) %>%
    dplyr::filter(model!='UMass-MechBayes')
res_ny %>%
    dplyr::filter(location_name=='New York') %>%
    ggplot(aes(x=model, y=point, color=model)) +
    geom_errorbar(aes(ymin= quantile_0.025, ymax =  quantile_0.975)) +
    facet_wrap(facets='target_week_end_date') +
    geom_point() +
    labs(y='Projected Deaths') +
    theme_bw() +
    theme(axis.text.x=element_blank()) +
    ggtitle('Projected New York deaths for week ending')
#'
# combined view
pd <- position_dodge(width = 3) # use this to offset points and error bars
res_ny %>%
    ggplot(aes(x=target_week_end_date, y=point, color=model)) +
    geom_errorbar(aes(ymin= quantile_0.025, ymax =  quantile_0.975), position=pd) +
    geom_point(position=pd) +
    labs(y='Projected Deaths') +
    geom_line(position=pd) +
    theme_bw() +
    theme(legend.position='bottom') +
    ggtitle('Projected New York deaths for week ending')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.