-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
119 lines (84 loc) · 3.51 KB
/
README.Rmd
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
output: github_document
always_allow_html: true
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
message = FALSE,
warning = FALSE,
echo = TRUE
)
```
# gesundheitsaemter
<!-- badges: start -->
<!-- badges: end -->
The goal of `gesundheitsaemter` is to provide data sets for the analysis of German Health Authorities (Gesundheitsaemter). The package includes five different data sets collected from three different sources.
|Data set name | Content | data source URL |
|--------------|---------|-----------------|
|health_departments|General overview of German Health Authorities (Gesundheitsaemter)| [link](https://www.rki.de/DE/Content/Infekt/IfSG/Software/software_node.html)|
|authority_zip_range|All possible zip codes that are assigned to the health authority| [link](https://www.rki.de/DE/Content/Infekt/IfSG/Software/software_node.html)|
|communities|All possible community names, be reminded that one community can have several zip codes and vice versa|[link](https://www.rki.de/DE/Content/Infekt/IfSG/Software/software_node.html)|
|population_zip|Population and area assigned to every German zip code|[link](https://www.suche-postleitzahl.org)|
|metadata_rki|Contact information and further information about the health authority|[link](https://www.rki.de/DE/Content/Infekt/IfSG/Software/software_node.html)|
|metadata_google|Geo location in the health department data set is generated using the google maps api with the R package [ggmap](https://github.com/dkahle/ggmap), this file includes or meta data of this interface| [link](https://cloud.google.com/maps-platform)|
## Installation or Import
You can install the released version of `gesundheitsaemter` from [Github](https://github.com/gstephan30/gesundheitsaemter) with:
```{r eval=FALSE}
devtools::install_github("gstephan30/gesundheitsaemter")
```
For users not wanting to install the data, direct download links are:
[](./data/health_departments.csv)
```{r eval=FALSE}
```
## Merging the data
Every data set has an individual identifier for merging, this can be seen here:
<style>
.aligncenter {
text-align: center;
}
</style>
<p class="aligncenter">
<img src="man/figures/gesundheitsaemter_merging.png" alt="how to merge" width=60% align="middle" />
</p>
## Explore Data
The primary data set with an overview of all German Health Authorities is `health_departments`:
```{r example}
library(gesundheitsaemter)
health_departments
```
With merging you can inspect the population covered by each health authority. For demonstration purposes we are just interested in health authorities of assigned to the city of Berlin.
```{r}
library(dplyr)
berlin_departments <- health_departments %>%
filter(place == "Berlin") %>%
select(authority_id, name, long, lat) %>%
left_join(
authority_zip_range
) %>%
left_join(
population_zip
) %>%
group_by(authority_id, name, long, lat) %>%
summarise(total_population = sum(population, na.rm = TRUE)) %>%
arrange(desc(total_population))
berlin_departments %>%
knitr::kable("html") %>%
kableExtra::kable_styling("striped")
```
Plotting in relation to the covered population:
```{r leaflet}
library(leaflet)
berlin_departments %>%
leaflet() %>%
addTiles() %>%
addCircleMarkers(
lng = ~long,
lat = ~lat,
fill = ~total_population,
radius = ~total_population/10000,
label = ~paste0(name, ", Population: ", total_population))
```