India

Column

Daily Incidence in India

Column

The reproductive number (R0) is calculated from the R package earlyR by assuming serial interval mean and standard deviation 7.5 and 3.4 respectively. The reproductive number for COVID-19 virus is understood to be between 2 to 2.5 according to the Situation Report – 46 of WHO

State wise Incidence as per Wikipedia

World

---
title: "COVID-19 in India"
author: "Sandeep N"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    source_code: embed
    vertical_layout: fill
---

```{r setup, include=FALSE}
devtools::install_github("RamiKrispin/coronavirus")
covid<-coronavirus::coronavirus

library(flexdashboard)
library(coronavirus)
library(earlyR)
library(EpiEstim)
library(incidence)
library(distcrete)
library(janitor)
library(tidyverse)
library(lubridate)
library(rvest)
library(plotly)
library(echarts4r.maps)
library(echarts4r)
```

Sidebar {.sidebar}
=======================================================================
### Acknowledgement

This dashboard presents information on COVID-19. The package coronavirus is available on CRAN of [John Hopkins University](https://hub.jhu.edu/2020/01/23/coronavirus-outbreak-mapping-tool-649-em1-art1-dtd-health/). The dataset is updated every day by @Rami_Krispin (https://ramikrispin.github.io/coronavirus/).

I would like to thank Rubén F. Bustillo (https://rpubs.com/rubenfbc/coronavirus) whose dashboard helped me in improvising my work and to come across echarts4r.


India
=======================================================================

Column {data-width=550}
-----------------------------------------------------------------------

### Daily Incidence in India

```{r}

data <- covid %>%
  filter(Country.Region %in% "India")

ggplotly(ggplot(data = data, aes(date,cases, fill = type)) +
  geom_col(position = "nudge")+
  theme_minimal() +
    geom_text(aes(label = cases, y = cases+0.5)) +
    ggtitle("Incidence cases of COVID-19 in India",
            "As of 9th march "))
  
```

Column {data-width=450}
-----------------------------------------------------------------------

### The reproductive number (R0) is calculated from the R package earlyR by assuming serial interval mean and standard deviation  7.5 and 3.4 respectively. The reproductive number for COVID-19 virus is understood to be between 2 to 2.5 according to the [Situation Report – 46 of WHO](https://www.who.int/docs/default-source/coronaviruse/situation-reports/20200306-sitrep-46-covid-19.pdf?sfvrsn=96b04adf_2)

```{r}
inci <- incidence(data$date)
rep <-  get_R(inci,si_mean = 7.5, si_sd = 3.4, max_R = 10 )
plot(rep)
```

### State wise Incidence as per Wikipedia

```{r}
wp_page_url <- "https://en.wikipedia.org/wiki/2020_coronavirus_outbreak_in_India"
# read the page using the rvest package.
outbreak_webpage <- read_html(wp_page_url)

title <- outbreak_webpage %>%
  html_node("title") %>%
  html_text()

# parse the web page and extract the data from the second table
India_cases <- outbreak_webpage %>% html_nodes("table") %>% .[[3]] %>% 
  html_table(fill = TRUE)

colnames(India_cases) <- India_cases[1,]

India_cases <- data.frame(India_cases[c(-1),])

n <- dim(India_cases)[1]

sub <- India_cases$State.or.Union.territory[n-1]
Total <- India_cases$Cases[n-2]

India_cases   <- India_cases[c(-n,-(n-1),-(n-2)) ,]
Deaths <- sum(as.numeric(India_cases$Deaths))
Recovery <- sum(as.numeric(India_cases$Recoveries))

 India_cases %>%
  ggplot(aes(reorder(State.or.Union.territory, as.numeric(Cases)), 
             as.numeric(Cases), fill = State.or.Union.territory)) +
  geom_col()+
   #scale_fill_viridis(discrete = TRUE)+
  theme_minimal()+
  theme(legend.position = "none",
        axis.text = element_text(colour = "black", size = 10))+
  coord_flip() +
  geom_text(aes(label = Cases, y = as.numeric(Cases)+0.8), size = 6)+
  ggtitle(title, paste("As of (",Sys.time(),")")) +
  xlab("") + ylab("Number of confirmed cases") +
   labs(caption = sub) +
   annotate("text", x = 2.4, y = 10, label = paste(Total,"- Total confirmed cases in India"),
            fontface = "bold")+
   annotate("text", x = 1.4, y = 10, label = paste(Deaths,"Deaths and", Recovery, "Recoveries"))

```

World
=======================================================================

```{r}
data <- covid %>% 
  group_by(Country.Region, type) %>%
  summarise(total = sum(cases)) %>%
  pivot_wider(names_from =  type, 
              values_from = total) %>%
  ungroup() %>%
  mutate(country = trimws(Country.Region))


map <- data %>%
  mutate(country = recode_factor(country,
                                 "US" = "United States",
                                 "Mainland China" = "China",
                                 "UK" = "United Kingdom",
                                 "UAE" = "United Arab Emirates",
                                 "South Korea"= "Korea"))

map %>%
  e_charts(country) %>%
  e_map(confirmed) %>%
  e_title("Confirmed Cases", left= "center") %>%
  e_visual_map()
  #e_theme("infographic")
```