Description Usage Arguments Value Examples
View source: R/get_india_regional_cases.R
Get Indian cases or deaths by state
1 | get_india_regional_cases(data = "cases")
|
data |
Character string specifying whether to return case or death count |
A dataframe of case or death counts
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.