Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nevrome/covid19germany
R package - Load, visualise and analyse daily updated data on the COVID-19 outbreak in Germany
https://github.com/nevrome/covid19germany
coronavirus covid-19 data-retrieval germany r
Last synced: about 2 months ago
JSON representation
R package - Load, visualise and analyse daily updated data on the COVID-19 outbreak in Germany
- Host: GitHub
- URL: https://github.com/nevrome/covid19germany
- Owner: nevrome
- License: other
- Created: 2020-03-21T12:16:52.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-27T15:52:01.000Z (about 2 years ago)
- Last Synced: 2024-04-16T00:20:44.266Z (9 months ago)
- Topics: coronavirus, covid-19, data-retrieval, germany, r
- Language: R
- Homepage:
- Size: 22.1 MB
- Stars: 48
- Watchers: 5
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
editor_options:
chunk_output_type: console
---
```{r, echo=FALSE, message=FALSE}
library(magrittr)
library(covid19germany)
library(ggplot2)rki <- get_RKI_timeseries(cache_dir = "cache", timeout_for_download = 100000)
p1 <- rki %>% plot_RKI_timeseries("Age", "NumberNewTestedIll", label = F) +
theme(axis.text.x = element_blank(), axis.title.x = element_blank())
p2 <- rki %>% plot_RKI_timeseries("Age", "NumberNewDead") +
theme(axis.text.x = element_blank(), axis.title.x = element_blank(),
axis.title.y = element_blank())
p4 <- rki %>% plot_RKI_timeseries("Age", "CumNumberTestedIll", label = F) +
xlab("")
p5 <- rki %>% plot_RKI_timeseries("Age", "CumNumberDead") +
theme(axis.title.y = element_blank()) +
xlab("")p <- cowplot::plot_grid(p1, p2, p4, p5,
nrow = 2, ncol = 2,
rel_widths = c(0.9,1),
rel_heights = c(0.9,1), align = "v", axis = 'l'
)ggsave("man/figures/README_plot.png", device = "png", p, width = 10, height = 4, scale = 1.7, bg = "white")
```![](man/figures/README_plot.png)
```{r, echo=FALSE, message=FALSE, warning=FALSE}
library(magrittr)
library(ggplot2)vac_ts <- covid19germany::get_RKI_vaccination_timeseries()
p_vac <- vac_ts %>%
dplyr::select(-NumberVaccinations) %>%
tidyr::pivot_longer(
cols = tidyselect::starts_with("Number"),
names_to = "Type",
values_to = "Number"
) %>%
dplyr::mutate(
Type = dplyr::recode(
Type,
"NumberFirstInjections" = "First dose",
"NumberSecondInjections" = "Second dose",
"NumberFirstBoosterInjections" = "First Booster",
"NumberSecondBoosterInjections" = "Second Booster",
) %>% factor(levels = c(
"First dose", "Second dose", "First Booster", "Second Booster"
) %>% rev)
) %>%
dplyr::group_by(
month = formatC(lubridate::month(Date, label = FALSE), width = 2, format = "d", flag = "0"),
year = lubridate::year(Date),
Type
) %>%
dplyr::summarise(
Number = sum(Number, na.rm = T),
.groups = "drop"
) %>%
tidyr::unite(col = "year_month", year, month) %>%
ggplot() +
geom_bar(aes(x = year_month, y = Number, fill = Type), stat = "identity") +
scale_y_continuous(labels = scales::comma) +
ggtitle(paste0(lubridate::today(), ": Number of vaccination doses administered")) +
theme_minimal() +
theme(
axis.title.x = element_blank(),
axis.text.x = ggplot2::element_text(angle = 60, vjust = 1, hjust = 1)
)ggsave("man/figures/README_plot_vac.png", device = "png", p_vac, width = 10, height = 3, scale = 1, bg = "white")
``````{r, echo=FALSE, message=FALSE, warning=FALSE}
spatial <- covid19germany::get_RKI_spatial()
```![](man/figures/README_plot_vac.png)
[![R-CMD-check](https://github.com/nevrome/covid19germany/actions/workflows/check-release.yaml/badge.svg)](https://github.com/nevrome/covid19germany/actions/workflows/check-release.yaml)
[![Coverage Status](https://img.shields.io/codecov/c/github/nevrome/covid19germany/master.svg)](https://codecov.io/github/nevrome/covid19germany?branch=master)# covid19germany
An R package to load, visualise and analyse daily updated data on the COVID-19 outbreak in Germany. This package exists to simplify data analysis and was developed in the context of the [#WirvsVirus hackathon](https://www.bundesregierung.de/breg-de/themen/coronavirus/wir-vs-virus-1731968).
- [**Install**](#Install)
- [**Functions and data**](#functions-and-data)
- [RKI vaccination progress](#rki-vaccination-progress)
- [RKI timeseries](#rki-timeseries)
- [RKI spatial](#rki-spatial)
- [Population numbers](#population-numbers)
- [Hospital beds](#hospital-beds)## Install
Install the development version from github with
```
if(!require('remotes')) install.packages('remotes')
remotes::install_github("nevrome/covid19germany")
```## Functions and data
### RKI vaccination progress
[Daily updated RKI data about COVID-19 vaccinations in germany](https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquoten-Tab.html). Provided by the Robert Koch Institut.
```
rki_vaccinations_timeseries <- covid19germany::get_RKI_vaccination_timeseries()
```### RKI timeseries
```
rki <- covid19germany::get_RKI_timeseries()
```[Daily updated RKI data about COVID-19 cases and deaths for germany (timeseries)](https://npgeo-corona-npgeo-de.hub.arcgis.com/datasets/dd4580c810204019a7b8eb3e0b329dd6_0). Provided by the Bundesamt für Kartographie und Geodäsie as well as the Robert Koch Institut.
You can convert this RKI data to daily timeseries for federal states (Bundesland), administrative districts (Landkreis), gender (Gender) and/or age (Age).
```
covid19germany::group_RKI_timeseries(rki, Bundesland)
covid19germany::group_RKI_timeseries(rki, Landkreis)
covid19germany::group_RKI_timeseries(rki, Gender)
covid19germany::group_RKI_timeseries(rki, Age)
```It's possible to group by multiple of these at once, e.g.
```
covid19germany::group_RKI_timeseries(rki, Bundesland, Age)
```### RKI spatial
```
covid19germany::get_RKI_spatial("Bundesland")
covid19germany::get_RKI_spatial("Landkreis")
```[Daily updated RKI data about COVID-19 cases and deaths for germany (spatial)](https://npgeo-corona-npgeo-de.hub.arcgis.com/search?groupIds=b28109b18022405bb965c602b13e1bbc). Provided by the Bundesamt für Kartographie und Geodäsie as well as the Robert Koch Institut.
### Population numbers
```
covid19germany::ew_laender
covid19germany::ew_kreise
covid19germany::ew_alter
```[Population numbers for the german Länder](https://www.statistikportal.de/de/bevoelkerung/flaeche-und-bevoelkerung) and [Kreise](https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/04-kreise.html) on 2018-12-31. Provided by the Statistisches Bundesamt. (Population data for administrative units of Berlin in dataset ew_laender is missing.)
### Hospital beds
```
covid19germany::hospital_beds
```[Hospital beds and ICUs in Germany](http://www.gbe-bund.de/gbe10/f?f=328::Intensivstation) in 2017 with a last update from 2018-11-13. Provided by the Statistisches Bundesamt as well as the Robert Koch Institut.