Main Analysis

Deaths / Cases rate {.tabset .tabset-fade .tabset-pills}

Rate of death per number of confirmed case. Note that this is heavily dependand on the number of tests being performed (data not available in this report)

death.vs.cases.plot(death.vs.cases, state.filter = countries, expand = FALSE) 

Cases over time {.tabset .tabset-fade .tabset-pills}

Confirmed cases {.tabset .tabset-fade .tabset-pills}

Latest data from r source.by

per 100k population

suppressWarnings({
  p <- ommit.start(after.100.dat$all, 'confirmed', params$confirmed.start, filter.states = countries, per.100k.flag = TRUE) %>% ggplotly() %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(round(cumul, digits = 2), big.mark = ',', trim = TRUE),
         absolute = format(cumul * population / 100000, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = days.after.100,  'Confirmed Cases' = cumul, text, absolute) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d.tmp <- d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = ~absolute,
            hovertemplate = paste0('<b>%{text}</b> <i>(%{customdata})</i>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)
d.tmp

per 100k population (log10 scale)

d.tmp %>% 
  layout(yaxis = list(type = 'log'))

Total values

suppressWarnings({
  p <- ommit.start(after.100.dat$all, 'confirmed', params$confirmed.start, filter.states = countries) %>% ggplotly() %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(cumul, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = days.after.100,  'Confirmed Cases' = cumul, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

Log10 scale

suppressWarnings({
  p <- ommit.start(after.100.dat$all, 'confirmed', params$confirmed.start, filter.states = countries, log2.flag = TRUE) %>% ggplotly() %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(cumul, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = days.after.100,  'Confirmed Cases' = cumul, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = gsub('log2', 'log10', p$x$layout$yaxis$title$text), type = 'log')) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

Deaths {.tabset .tabset-fade .tabset-pills}

Latest data from r source.by

per 100k population

suppressWarnings({
  p <- ommit.start(after.100.dat$all, 'death', params$death.start, filter.states = countries, per.100k.flag = TRUE) %>% ggplotly() %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(round(cumul, digits = 2), big.mark = ',', trim = TRUE),
         absolute = format(cumul * population / 100000, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = days.after.100,  'Confirmed Cases' = cumul, text, absolute) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d.tmp <- d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = ~absolute,
            hovertemplate = paste0('<b>%{text}</b> <i>(%{customdata})</i>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)
d.tmp

per 100k population (log10 scale)

d.tmp %>% 
  layout(yaxis = list(type = 'log'))

Total deaths

suppressWarnings({
  p <- ommit.start(after.100.dat$all, 'death', params$death.start, filter.states = countries) %>% ggplotly() %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(cumul, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = days.after.100,  'Confirmed Cases' = cumul, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

Log10 scale

suppressWarnings({
  p <- ommit.start(after.100.dat$all, 'death', params$death.start, filter.states = countries, log2.flag = TRUE) %>% ggplotly() %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(cumul, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = days.after.100,  'Confirmed Cases' = cumul, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = gsub('log2', 'log10', p$x$layout$yaxis$title$text), type = 'log')) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

New Cases and Deaths {.tabset .tabset-fade .tabset-pills}

Latest data from r source.by

Cases {.tabset .tabset-fade .tabset-pills}

per 100k population

New Confirmed Cases (per 100k population).

suppressWarnings({
  p <- last.days(last.days.dat, 'confirmed', params$last.days, countries, log2.flag = FALSE, per.100k.flag = TRUE, new.flag = TRUE) %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(round(cumul, digits = 2), big.mark = ',', trim = TRUE),
         absolute = format(cumul * population / 100000, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Confirmed Cases' = cumul, text, absolute) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = ~absolute,
            hovertemplate = paste0('<b>%{text}</b> <i>(%{customdata})</i>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

Total

suppressWarnings({
  p <- last.days(last.days.dat, 'confirmed', params$last.days, countries, log2.flag = FALSE, per.100k.flag = FALSE, new.flag = TRUE) %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(cumul, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Confirmed Cases' = cumul, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Confirmed Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

Deaths {.tabset .tabset-fade .tabset-pills}

Latest data from r source.by

per 100k population

New Deaths (per 100k population).

suppressWarnings({
  p <- last.days(last.days.dat, 'death', params$last.days, countries, log2.flag = FALSE, per.100k.flag = TRUE, new.flag = TRUE) %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(round(cumul, digits = 2), big.mark = ',', trim = TRUE),
         absolute = format(cumul * population / 100000, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Deaths' = cumul, text, absolute) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Deaths`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = ~absolute,
            hovertemplate = paste0('<b>%{text}</b> <i>(%{customdata})</i>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

Total

suppressWarnings({
  p <- last.days(last.days.dat, 'death', params$last.days, countries, log2.flag = FALSE, per.100k.flag = FALSE, new.flag = TRUE) %>% 
    ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(cumul, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Deaths' = cumul, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Deaths`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)

Rolling averages of last 7 days {.tabset .tabset-fade .tabset-pills}

Average Cases {.tabset .tabset-fade .tabset-pills}

Latest data from r source.by

per 100k population

Each data point is an average of new cases from the previous 7 days (per 100k population).

suppressWarnings({
  p <- last.week.cumulative(last.week.dat, 'confirmed', 7, countries, log2.flag = FALSE, per.100k.flag = TRUE) %>% ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(round(last.week.var, digits = 2), big.mark = ',', trim = TRUE),
         absolute = format(last.week.var * population / 100000, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Average Cases' = last.week.var, text, absolute) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d.tmp <- d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Average Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = ~absolute,
            hovertemplate = paste0('<b>%{text}</b> <i>(%{customdata})</i>', '<br><i>%{x}</i>'),
            text = ~text

            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)
d.tmp

per 100k population Log10 scale

Each data point is an average of new cases from the previous 7 days.

d.tmp %>% 
  layout(yaxis = list(type = 'log'))

Total

Each data point is an average of new cases from the previous 7 days.

suppressWarnings({
  p <- last.week.cumulative(last.week.dat, 'confirmed', 7, countries, log2.flag = FALSE, per.100k.flag = FALSE) %>% ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(last.week.var, digits = 2, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Average Cases' = last.week.var, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d.tmp <- d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Average Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)
d.tmp

Log10 scale

Each data point is an average of new cases from the previous 7 days.

d.tmp %>% 
  layout(yaxis = list(type = 'log'))

Average Deaths {.tabset .tabset-fade .tabset-pills}

Latest data from r source.by

per 100k population

Each data point is an average of new cases from the previous 7 days (per 100k population).

suppressWarnings({
  p <- last.week.cumulative(last.week.dat, 'death', 7, countries, log2.flag = FALSE, per.100k.flag = TRUE) %>% ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(round(last.week.var, digits = 2), big.mark = ',', trim = TRUE),
         absolute = format(last.week.var * population / 100000, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Average Deaths' = last.week.var, text, absolute) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d.tmp <- d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Average Deaths`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = ~absolute,
            hovertemplate = paste0('<b>%{text}</b> <i>(%{customdata})</i>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)
d.tmp

per 100k population Log10 scale

Each data point is an average of new cases from the previous 7 days.

d.tmp %>% 
  layout(yaxis = list(type = 'log'))

Total

Each data point is an average of new cases from the previous 7 days.

suppressWarnings({
  p <- last.week.cumulative(last.week.dat, 'death', 7, countries, log2.flag = FALSE, per.100k.flag = FALSE) %>% ggplotly()
})

d <- plotly_data(p) %>%  
  mutate(text = format(last.week.var, big.mark = ',', trim = TRUE)) %>% 
  select(Country = state,  Date = date,  'Average Cases' = last.week.var, text) %>% 
  arrange(Date) %>% 
  highlight_key(~Country)

pal <- viridis(plotly_data(p) %>% nrow, end = .8, option = 'A')

d.tmp <- d %>% plot_ly() %>% 
  add_trace(x = ~Date, 
            y = ~`Average Cases`, 
            color = ~Country, 
            type = 'scatter',
            mode = 'lines+markers', 
            colors = pal, 
            name = ~Country,
            customdata = '',
            hovertemplate = paste0('<b>%{text}</b>', '<br><i>%{x}</i>'),
            text = ~text
            ) %>% 
  layout(legend = list(x = 0.1, y = 1), dragmode = FALSE,
         title = p$x$layout$title$text,
         xaxis = list(title = p$x$layout$xaxis$title$text),
         yaxis = list(title = p$x$layout$yaxis$title$text)) %>% 
  highlight(on = 'plotly_click', off = 'plotly_doubleclick', persistent = FALSE)
d.tmp

Log10 scale

Each data point is an average of new cases from the previous 7 days.

d.tmp %>% 
  layout(yaxis = list(type = 'log'))


averissimo/r-analysis-covid19 documentation built on April 24, 2021, 11:01 a.m.