mirror of
https://github.com/netzbegruenung/green-spider-analysis.git
synced 2024-05-05 20:03:41 +02:00
Update basics.R
This commit is contained in:
parent
aee1360e7d
commit
f8dd4fa093
63
basics.R
63
basics.R
|
@ -1,17 +1,25 @@
|
|||
library(jsonlite)
|
||||
library(dplyr)
|
||||
library(ggplot2)
|
||||
library(scales)
|
||||
|
||||
# Frische Daten gibt es unter
|
||||
# https://green-spider.netzbegruenung.de/api/v1/spider-results/table/
|
||||
sites <- fromJSON("data/table.json")
|
||||
|
||||
# Beschreibung
|
||||
median(sites$score)
|
||||
mean(sites$score)
|
||||
|
||||
# Daten aufbereiten
|
||||
sites$generator[sites$generator == ""] <- "UNBEKANNT"
|
||||
sites_kv <- filter(sites, meta.level == "DE:KREISVERBAND")
|
||||
sites_ov <- filter(sites, meta.level == "DE:ORTSVERBAND")
|
||||
sites_generator_gcms <- filter(sites, generator == "typo3-gcms")
|
||||
sites_reachable <- filter(sites, rating.SITE_REACHABLE.value == "TRUE")
|
||||
|
||||
# die sites mit den CMS, die mind. 5 mal vorkommen
|
||||
# TODO: nicht filtern, sondern nicht-Top-CMSe in "SONSTIGE" umbenennen
|
||||
sites_top_cms <- sites %>% group_by(generator) %>% filter(n() >= 5) %>% filter(generator != "UNBEKANNT")
|
||||
|
||||
# Punkte
|
||||
|
@ -103,3 +111,58 @@ ggplot(sites_top_cms, aes(x = reorder(generator, -rating.HTTP_RESPONSE_DURATION.
|
|||
coord_flip() +
|
||||
labs(title="Antwortzeiten nach CMS", x="CMS", y="Antwortzeit in Millisekunden (logarithmisch, Median in blau)")
|
||||
ggsave("plots/antwortzeiten_nach_cms_log.png")
|
||||
|
||||
|
||||
## Verhältnis Punkte - Antwortzeit
|
||||
responsetime_score <- data.frame(score = (sites_reachable$score - sites_reachable$rating.HTTP_RESPONSE_DURATION.score),
|
||||
duration = sites_reachable$rating.HTTP_RESPONSE_DURATION.value)
|
||||
max_score = max(responsetime_score$score)
|
||||
score_breaks <- function(x, n = max_score) pretty(x, n)[pretty(x, n) %% 1 == 0]
|
||||
|
||||
### Als Punkt-Plot
|
||||
ggplot(responsetime_score, aes(floor(score), duration)) +
|
||||
geom_point() +
|
||||
geom_jitter(width = .5, height = .2) +
|
||||
geom_smooth(method = "loess")+
|
||||
scale_y_log10(limits = c(30, 10001)) +
|
||||
scale_x_continuous(breaks = score_breaks) +
|
||||
labs(title="Verhältnis Punktzahl und Antwortzeit",
|
||||
subtitle="Punktzahl auf ganze Zahlen gerundet, ohne Punkte für Antwortzeit",
|
||||
x="Punktzahl (ohne Punkte für Antwortzeit)",
|
||||
y="Antwortzeit (ms, logarithmisch)")
|
||||
ggsave("plots/antwortzeiten_zu_punkte_point_log.png")
|
||||
|
||||
### Als Box-Plot
|
||||
ggplot(responsetime_score, aes(floor(score), duration)) +
|
||||
geom_boxplot(aes(group = cut_interval(floor(score), (max_score - 1)))) +
|
||||
scale_y_log10(limits = c(30, 10001)) +
|
||||
scale_x_continuous(breaks = score_breaks) +
|
||||
labs(title="Verhältnis Punktzahl und Antwortzeit",
|
||||
x="Punktzahl (ohne Punkte für Antwortzeit)",
|
||||
y="Antwortzeit (ms, logarithmisch)")
|
||||
ggsave("plots/antwortzeiten_zu_punkte_box_log.png")
|
||||
|
||||
## Einzelne Site-Kriterien
|
||||
|
||||
# Feeds nach CMS
|
||||
ggplot(sites_top_cms, aes(rating.FEEDS.value)) +
|
||||
geom_bar(aes(fill = generator)) +
|
||||
scale_x_discrete(labels=c("Ohne Feed","Mit Feed")) +
|
||||
scale_fill_discrete(name = "CMS") +
|
||||
labs(title="Sites mit und ohne Feed nach CMS",
|
||||
x="",
|
||||
y="Anzahl Sites")
|
||||
ggsave("plots/feeds_nach_cms_a.png")
|
||||
|
||||
ggplot(sites_top_cms, aes(generator)) +
|
||||
geom_bar(aes(fill = rating.FEEDS.value)) +
|
||||
coord_flip() +
|
||||
scale_fill_discrete(name = "Feed vorhanden", labels = c("Nein", "Ja")) +
|
||||
labs(title="Sites mit und ohne Feed nach CMS",
|
||||
x="",
|
||||
y="Anzahl Sites")
|
||||
ggsave("plots/feeds_nach_cms_b.png")
|
||||
|
||||
# Feeds - Nur GCMS
|
||||
ggplot(sites_generator_gcms, aes(rating.FEEDS.value)) +
|
||||
geom_bar()
|
||||
|
|
Loading…
Reference in a new issue