-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplatform_report_de.Rmd
137 lines (114 loc) · 3.13 KB
/
platform_report_de.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
title: "Übersichtsplattformen"
author: "metacollect"
date: '`r format(Sys.time(), "%Y-%m-%d")`'
output:
pdf_document: default
html_document: default
params:
origins: ''
reach: ''
target_groups: ''
types: ''
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
message = FALSE,
warning = FALSE,
error = FALSE)
```
```{r libs, include=FALSE}
library(Vennerable)
library(ggplot2)
```
```{r definitions, include=FALSE}
get_factor_tibble <- function(vec) {
tmp <- sapply(vec, length)
return(tibble::tibble(Faktor = names(tmp), `Anzahl Plattformen` = tmp))
}
get_intersections <- function(groups, num = 2) {
pairs <- utils::combn(names(groups), num, simplify = FALSE)
inter <- numeric(length(pairs))
for (i in 1:length(pairs)) {
a <- groups[[pairs[[i]][1]]]
b <- groups[[pairs[[i]][2]]]
inter[i] <- length(intersect(a, b))
}
return(tibble::tibble(Paar = sapply(pairs, paste, sep = "", collapse = "\n"),
Schnittmenge = inter))
}
plot_factors <- function(data_table) {
ggplot2::ggplot(data = data_table,
mapping = ggplot2::aes(x = Faktor, y = `Anzahl Plattformen`)) +
ggplot2::geom_col() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
}
plot_pairs <- function(pairs) {
ggplot2::ggplot(pairs, aes(x = Paar, y = Schnittmenge)) +
ggplot2::geom_col() +
ggplot2::theme(axis.text.x = element_text(angle=45, hjust = 1))
}
```
## Plattform nach {.tabset}
```{r fig-setup, include=FALSE}
knitr::opts_chunk$set(fig.width = 7.5,
fig.height = 7.5,
out.width = '100%',
out.extra='keepaspectratio')
```
### Ursprung
```{r origins}
tmp <- get_factor_tibble(params$origins)
plot_factors(tmp)
```
Es existieren zu viele Ursprungsstädte, um Plattformen danach in einem Venn Diagram darzustellen.
```{r venn-origins}
# too many origins at the moment
# venn_origins <- Vennerable::Venn(params$origins)
# plot(venn_origins)
```
### Typ
```{r type-pairs}
tmp <- get_factor_tibble(params$types)
plot_factors(tmp)
```
```{r type}
tmp <- get_intersections(params$types)
plot_pairs(tmp)
tmp <- get_intersections(params$types, 3)
plot_pairs(tmp)
```
```{r venn-type}
plot(Venn(params$types[c("Zeitspendenplattform",
"Sachspendenplattform",
"Link-/Projektsammlung")]))
venn_types <- Vennerable::Venn(params$types)
plot(venn_types)
```
### Zielgruppe
```{r target_groups}
tmp <- get_factor_tibble(params$target_groups)
plot_factors(tmp)
```
```{r target_groups-pairs}
tmp <- get_intersections(params$target_groups)
plot_pairs(tmp)
tmp <- get_intersections(params$target_groups, 3)
plot_pairs(tmp)
```
```{r venn-target_groups}
plot(Venn(params$target_groups[c("Spender",
"Projekte",
"Volontäre")]))
venn_tg <- Vennerable::Venn(params$target_groups)
plot(venn_tg, type = "AWFE")
```
### Reichweite
```{r reach}
tmp <- get_factor_tibble(params$reach)
plot_factors(tmp)
```
```{r venn-reach}
venn_reach <- Vennerable::Venn(params$reach)
plot(venn_reach)
```