knitr::opts_chunk$set(echo = FALSE) library(covid19interventions) library(shiny) library(DT) library(ggplot2) library(tidyverse) library(changepoint) library(shinythemes) library(DT) library(knitr) data(mobility) data(county_intervention_cases) data(county_interventions) data(df_joined)
fluidPage( sidebarLayout( sidebarPanel( htmlOutput("state_selector"), htmlOutput("county_selector"), width = "5"), mainPanel(plotOutput("cpplot"), textOutput("pre_cp"), textOutput("post_cp"), width = 7))) output$state_selector <- renderUI({ selectInput( inputId = "state", label = "State:", choices = as.character(unique(df_joined$sub_region_1)), selected = "California") }) output$county_selector <- renderUI({ available <- df_joined[df_joined$sub_region_1 == input$state, "sub_region_2"] selectInput( inputId = "county", label = "County:", choices = unique(available), selected = "Los Angeles County") }) output$cpplot <- renderPlot({ cp_calc <- df_joined %>% filter(sub_region_1 == input$state & sub_region_2 == input$county & date < order_date & !is.na(workplace_int)) %>% select(workplace_int) %>% as.matrix() %>% as.numeric() %>% cpt.mean(method='AMOC') plot(cp_calc, cpt.col='blue', ylab = "Workplace Mobility Change from Baseline (%)", xlab = "Days since February 15") output$pre_cp <- renderText({paste("Pre Changepoint Mean: ", round(param.est(cp_calc)$mean[1], 2))}) output$post_cp <- renderText({paste("Post Changepoint Mean:", round(param.est(cp_calc)$mean[2]))}) })
knitr::include_graphics("output/database.PNG")
county_interventions_cases_sl <- county_intervention_cases %>% select(admin1, SAH_State_Date,cases, cases_2day_before, cases_week_after, cases_2week_after, cases_4week_after) %>% distinct(admin1, SAH_State_Date,cases, cases_2day_before, cases_week_after, cases_2week_after, cases_4week_after) #as.data.frame(county_interventions_cases_sl) datatable(county_interventions_cases_sl)
knitr::include_graphics("output/state_before_plot.PNG")
knitr::include_graphics("output/state_during_plot.PNG")
knitr::include_graphics("output/state_1w_after.PNG")
knitr::include_graphics("output/state_2w_after.PNG")
knitr::include_graphics("output/state_4w_after.PNG")
knitr::include_graphics("output/000036.png")
knitr::include_graphics("output/0000b4.png")
Did SAH interventions impact the curve?
Methodology
knitr::include_graphics("output/example3.png")
knitr::include_graphics("output/example4.png")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.