get_india_regional_cases: Get India daily cases

Description Usage Arguments Value Examples

View source: R/get_india_regional_cases.R

Description

Get Indian cases or deaths by state

Usage

1

Arguments

data

Character string specifying whether to return case or death count

Value

A dataframe of case or death counts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
## Mapping
# Filter to latest date
latest_cases <- dplyr::filter(india_cases, date == max(date))
# Note that basemaps are not updated to reflect Ladakh as a Union Territory, so joining separately
ladakh <- raster::getData('GADM', country='IND', level=2) %>%
  sf::st_as_sf() %>%
  dplyr::filter(NAME_2 == "Leh (Ladakh)" | NAME_2 == "Kargil") %>%
  dplyr::mutate(district = c("Leh", "Kargil"),
                state = "Ladakh") %>%
  dplyr::group_by(state) %>%
  dplyr::summarise()
india_map <- raster::getData('GADM', country='IND', level=1) %>%
  sf::st_as_sf() %>%
  dplyr::select(state = NAME_1) %>%
  # Join  maps
  rbind(ladakh) %>%
  # Join data
  dplyr::left_join(latest_cases, by = c("state" = "name"))
# Plot
india_map %>%
  ggplot2::ggplot(ggplot2::aes(fill = cases)) +
  ggplot2::geom_sf()

## End(Not run)

epiforecasts/NCoVUtils documentation built on June 26, 2020, 1:20 a.m.