Skip to content

Commit

Permalink
hinzufügen änderungen in block 2 und 4 + ausrichtungsdatei
Browse files Browse the repository at this point in the history
  • Loading branch information
FWisniewski44 committed Apr 10, 2024
1 parent 7d00e28 commit 5704075
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 32 deletions.
54 changes: 29 additions & 25 deletions auswertungRfiles/007_ausrichtung.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,35 @@ library(flextable)

setwd(dir = "~/Documents/uni/masterarbeit/scraping/polResp-css/auswertungRfiles/")

## FORMELN

# NORMALISIERUNG MIN-MAX
minMaxNorm <- function(x) {
(x - min(x)) / (max(x) - min(x))
}

newNormalPol <- function(x) {
# summe <- sum(df_col)
x / 83658
}

newNormalMed <- function(x) {
# summe <- sum(df_col)
x / 607370
}

## PROZENTUALE THEMENANTEILE PRO FOKUSGRUPPE
formel_prozentualisierung <- function(obj) {
obj / sum(obj)
}

# negation von %in%
"%ni%" <- Negate("%in%")

################################################################################
################################################################################
################################################################################

# BATCH LOADING: POLITIKERDATEN
filelist_pol <- list.files(path = "./politikerdaten",
pattern=".csv",
Expand Down Expand Up @@ -782,29 +811,4 @@ farbenPolitikerMedien <- c("PolitikerInnen"="#0000cd", "Medien"="#ffc125")
# ===============================================================================================================================================
# ===============================================================================================================================================

## FORMELN

# NORMALISIERUNG MIN-MAX
minMaxNorm <- function(x) {
(x - min(x)) / (max(x) - min(x))
}

newNormalPol <- function(x) {
# summe <- sum(df_col)
x / 83658
}

newNormalMed <- function(x) {
# summe <- sum(df_col)
x / 607370
}

## PROZENTUALE THEMENANTEILE PRO FOKUSGRUPPE
formel_prozentualisierung <- function(obj) {
obj / sum(obj)
}

# negation von %in%
"%ni%" <- Negate("%in%")

gc()
8 changes: 4 additions & 4 deletions auswertungRfiles/009_block2.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# auswertungsansätze für block 2

# ==============================================================================================================================================================
# ==============================================================================================================================================================
# =========================================================================================================================================================
# =========================================================================================================================================================
# => ERSTE ÜBERBLICKGRAPHIK: vergleich zwischen themenaufmerksamkeit zwischen pol und med im querschnitt, summiert, keine zeitreihe
# ==============================================================================================================================================================
# ==============================================================================================================================================================
# =========================================================================================================================================================
# =========================================================================================================================================================

# andere zeitebenen

Expand Down
11 changes: 8 additions & 3 deletions auswertungRfiles/011_block4.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ medienMinMax$weeknumber <- timeMedia_topics$weeknumber
medienMinMax$monthAsDate <- timeMedia_topics$monthAsDate
medienMinMax$monthNumber <- timeMedia_topics$monthNumber

# =============================================================================================================================================================
# =========================================================================================================================================================

# ukraine: gesamtgraphik im vergleich der sphären mit min-max-normalisierter skala
# interpretativ: wo sind die jeweiligen maximalen und minimalen themenwerte in den graphiken, macht vergleichbarkeit besser als prozentskala, da
Expand Down Expand Up @@ -221,6 +221,10 @@ covidMedien_maxima <- data.frame(xmin = as.Date("2022-01-09"), xmax = as.Date("2
annotate(geom="text", label = "Russ.\nInvasion", x=as.Date("2022-03-01"), y=0.90, color = "#ff6347", size=3.5) +
geom_vline(xintercept = as.Date("2022-01-26"), linewidth = 1.5, colour = "#ff6347aa") +
annotate(geom="text", label = "Orientierungsdeb.\nImpfpflicht", x=as.Date("2022-02-02"), y=0.35, color = "#ff6347", size=3) +
geom_rect(data = covidMedien_maxima,
aes(xmax=xmax, ymax=ymax, xmin=xmin, ymin=ymin),
fill = "#ff6347aa", colour = "black", alpha = 0.5, inherit.aes = F) +
annotate(geom="text", label = "Proteste,\nImpfpflicht,\nOmikron", x=as.Date("2022-01-20"), y=0.4, color = "#ff6347", size=3) +
scale_color_manual(name="Akteursgruppe", values = farbenPolitikerMedien) +
scale_x_date(breaks = "1 week", labels = date_format(format = "%b\nKW %W", locale = "de"),
limits = as.Date(c("2022-01-01", "2022-03-31")), expand = c(0,0)) +
Expand All @@ -231,7 +235,7 @@ covidMedien_maxima <- data.frame(xmin = as.Date("2022-01-09"), xmax = as.Date("2
theme(axis.text.x = element_text(size = 9, vjust = 0.5), legend.position = "bottom",
legend.text = element_text(size = 9, face = "italic"), legend.title = element_text(face = "bold")) +
ggtitle("Zoom: Anfang 2022, Prä-Kriegsphase"))
# ggplotly(covidZoom_graphik_anfang2022)
ggplotly(covidZoom_graphik_anfang2022)

(covidZoom_graphik_impfpflicht <- ggplot() +
geom_line(data = covidZoom_medien_impfpflicht, aes(x=dateTime, y=covid, colour = "Medien")) +
Expand Down Expand Up @@ -281,7 +285,8 @@ annotate_figure(block4Covid,
top = text_grob("Vergleichende Untersuchung der Akteurssphären für das Thema Covid", size = 20, face = "bold"),
bottom = text_grob("Zeitebene: täglich.", size = 8, face = "italic", hjust = 1, x = 1))

View(alleMedien %>% filter(covid ==1) %>% filter(dateTime == "2022-02-01"))
View(allePolitiker %>% filter(covid ==1) %>% filter(dateTime == "2022-01-11"))
plot(aggregate(allePolitiker, covid~dateTime, FUN = mean), type = "l")

# =========================================================================================================================================================

Expand Down

0 comments on commit 5704075

Please sign in to comment.