0.1 Setup and import

knitr::opts_chunk$set(echo = TRUE, fig.width=8, fig.height=4)
knitr::opts_knit$set(root.dir = "C:/Users/Peter/Documents/GU/data/som/")
library(dplyr)
## Warning: Installed Rcpp (0.12.12) different from Rcpp used to build dplyr (0.12.11).
## Please reinstall dplyr to avoid random crashes or undefined behavior.
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(rio)
library(ggplot2)
library(RColorBrewer)
library(tidyverse)
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag():    dplyr, stats
theme_set(theme_minimal())
set.seed(1234)

# Läs in Super-SOM.
if(file.exists("supersom.RData"))
{ 
  print("Load RData")
  load("supersom.rdata")
} else {
  print("Import")
  system.time(supersom <- import("supersom/SND0905_SuperRSOM_v5.sav"))
  print("Saving RData")
  save.image(file="supersom.rdata")
}
## [1] "Load RData"
# Recode rank variable into binary categorical factor.
dummy <- function(x, one=c(1, 2, 3, 4), zero=c(6, 7), labels=c("5 days/week or more", "More seldom"))
{
  newx <- NA
  newx[x %in% one]  <- 1
  newx[x %in% zero] <- 0
  newx <- factor(newx, levels=c(1, 0), labels=labels)
  return(newx)
}

# Recode rank variable into trichotomous categorical factor.
trichotomy <- function(x, two, one, zero, labels=c("Daily", "Weekly", "Never/seldom"))
{
  newx <- NA
  newx[x %in% two]  <- 2
  newx[x %in% one]  <- 1
  newx[x %in% zero] <- 0
  newx <- factor(newx, levels=c(2, 1, 0), labels=labels)
  return(newx)
}

0.1.1 Recode Super-SOM 1986-2015

In general:

  • 5 days/week or more is defined as at least 5 days per week.
  • More seldom is defined as less than 5 days per week, including never.
# Set election years to a binary variable.
supersom <- supersom %>% mutate(electionyear = case_when(year %in% c(1988, 1991, 1994, 1998, 2002, 2006, 2010, 2014) ~ 1, TRUE ~ 0)) 

# Demography.
supersom$age4a <- rio::factorize(supersom$age4a)
supersom$edu3 <- rio::factorize(supersom$edu3)
supersom$ideology <- supersom$ba10       # Self-reported political left/right placement 1-5.
supersom$ideology[supersom$ideology >= 98] <- NA
supersom$polinterest <- supersom$ca10 %>% recode("1"="4", "2"="3", "3"="2", "4"="1") %>% as.numeric()
supersom$polinterest <- factor(supersom$polinterest, levels=c(1, 2, 3, 4), labels=c("No political interest", "Low", "Medium", "High political interest"))
supersom$polinterest.num <- as.numeric(supersom$polinterest)   # Numeric 1-4 political interest.

# Public service.
supersom$svt1 <- supersom$jd20a             # SVT1
supersom$svt2 <- supersom$jd20b             # SVT2 (1992-2014)
supersom$svt1svt2 <- supersom$jd20c         # SVT1/SVT2 (2006-2013)
supersom$rapport <- supersom$jh10d          # SVT1 Rapport
supersom$aktuellt <- supersom$jh10c         # SVT2 Aktuellt
supersom$aktuelltrapport <- supersom$jh10e  # Aktuellt/Rapport
supersom$ekot <- supersom$jh10b             # SR Ekot

# Trust SVT.
supersom$trust.svt <- supersom$ka502a %>% recode("1"="3", "2"="3", "3"="2", "4"="1", "5"="1")
## Warning: Unreplaced values treated as NA as .x is not compatible. Please
## specify replacements exhaustively or supply .default
supersom$trust.svt <- factor(supersom$trust.svt, levels=c(3, 2, 1), labels=c("High trust", "Neither low nor high", "Low trust"))
supersom$trust.sr <- supersom$ka502e %>% recode("1"="3", "2"="3", "3"="2", "4"="1", "5"="1")
## Warning: Unreplaced values treated as NA as .x is not compatible. Please
## specify replacements exhaustively or supply .default
supersom$trust.sr <- factor(supersom$trust.sr, levels=c(3, 2, 1), labels=c("High trust", "Neither low nor high", "Low trust"))

# Trust SVT binary.
supersom$trust.svt.dich <- supersom$ka502a %>% recode("1"="1", "2"="1", "3"="999", "4"="0", "5"="0")
## Warning: Unreplaced values treated as NA as .x is not compatible. Please
## specify replacements exhaustively or supply .default
supersom$trust.svt.dich <- factor(supersom$trust.svt.dich, levels=c(1, 0), labels=c("High trust", "Low trust"))
supersom$trust.sr.dich <- supersom$ka502e %>% recode("1"="1", "2"="1", "3"="0", "4"="999", "5"="0")
## Warning: Unreplaced values treated as NA as .x is not compatible. Please
## specify replacements exhaustively or supply .default
supersom$trust.sr.dich <- factor(supersom$trust.sr.dich, levels=c(1, 0), labels=c("High trust", "Low trust"))

# Internet, social networking sites.
supersom$internet <- supersom$jb19        # Internet use last 12 months (1995-)
supersom$internetnews <- supersom$jb110c  # Internet news use (2005-) 
supersom$sns <- supersom$jb110p           # Social media use, e.g. Facebook, Twitter (2009-)

# Recode into binary.
supersom$svt1.dich     <- dummy(supersom$svt1, one=c(2, 3), zero=c(4, 5, 6, 7))
supersom$svt2.dich     <- dummy(supersom$svt2, one=c(2, 3), zero=c(4, 5, 6, 7))
supersom$rapport.dich  <- dummy(supersom$rapport, one=c(1, 2), zero=c(3, 4, 5, 6))
supersom$aktuellt.dich <- dummy(supersom$aktuellt, one=c(1, 2), zero=c(3, 4, 5, 6))
supersom$ekot.dich     <- dummy(supersom$ekot, one=c(1, 2), zero=c(3, 4, 5, 6))
supersom$sns.dich      <- dummy(supersom$sns, one=c(7, 6), zero=c(5, 4, 3, 2, 1))
supersom$internet.dich <- dummy(supersom$internet, one=c(5), zero=c(4,3,2,1), labels=c("Use internet daily", "Use internet more seldom"))
supersom$internetnews.dich <- dummy(supersom$internetnews, one=c(7,6), zero=c(5,4,3,2,1))

# Recode into trichotomoy
supersom$svt1.tri     <- trichotomy(supersom$svt1, two=c(2), one=c(3, 4, 5), zero=c(6, 7))
supersom$svt2.tri     <- trichotomy(supersom$svt2, two=c(2), one=c(3, 4, 5), zero=c(6, 7))
supersom$rapport.tri  <- trichotomy(supersom$rapport, two=c(1), one=c(2, 3, 4), zero=c(5, 6))
supersom$aktuellt.tri <- trichotomy(supersom$aktuellt, two=c(1), one=c(2, 3, 4), zero=c(5, 6))
supersom$ekot.tri     <- trichotomy(supersom$ekot, two=c(1), one=c(2, 3, 4), zero=c(5, 6))
supersom$sns.tri      <- trichotomy(supersom$sns, two=c(7), one=c(6, 5), zero=c(4, 3, 2, 1))

# Combine Aktuellt/Rapport into single variable.
supersom$aktuelltrapport.dich[supersom$year %in% c(1984:2004)] <- ifelse(supersom$aktuellt[supersom$year %in% c(1984:2004)] <= 5 | supersom$rapport[supersom$year %in% c(1984:2004)] <= 5, 1, 0)
supersom$aktuelltrapport.dich[supersom$year %in% c(2005:2015)] <- ifelse(supersom$aktuelltrapport[supersom$year %in% c(2005:2015)] <= 5, 1, 0)

# Public service use: Using Rapport/Aktuellt/Ekot at least 5 days/week (or not).
supersom <- supersom %>%
  mutate(psuse = case_when(is.na(aktuelltrapport.dich) & is.na(ekot.dich) ~ 999,
                           aktuelltrapport.dich == 1                      ~ 1, # Aktuellt/Rapport
                           ekot.dich == 1                                 ~ 1, # Ekot
                           TRUE                                           ~ 0))
supersom$psuse <- factor(supersom$psuse, levels=c(1, 0), labels=c("PS news at least 5 days/week", "PS news more seldom"))

# Daily public service use: Using Rapport/Aktuellt/Ekot daily (or not).
supersom <- supersom %>%
  mutate(psuse.daily = case_when(jh10b == 1 ~ 1, # Ekot
                                 jh10c == 1 ~ 1, # Aktuellt
                                 jh10d == 1 ~ 1, # Rapport
                                 jh10e == 1 ~ 1, # Aktuellt/Rapport
                                 is.na(jh10b) & is.na(jh10c) & is.na(jh10d) & is.na(jh10e) ~ 999,
                                 TRUE       ~ 0))
supersom$psuse.daily <- factor(supersom$psuse.daily, levels=c(1, 0), labels=c("PS news daily", "PS news more seldom"))

supersom$aktuelltrapport.dich <- factor(supersom$aktuelltrapport.dich, levels=c(1, 0), labels=c("Daily/weekly", "Never/seldom"))

# Lef/right block.
supersom$partyblock[supersom$cb10 %in% c(1, 2)] <- 1     # Left: S+V
supersom$partyblock[supersom$cb10 %in% c(3, 4, 5, 6)] <- 2  # Right: C+L+M+KD
supersom$partyblock[supersom$partyblock > 2] <- NA
supersom$partyblock <- factor(supersom$partyblock, levels=1:2, labels=c("Left", "Right"), ordered=FALSE)
supersom$partyblock.num <- as.numeric(supersom$partyblock %>% recode("1"="-1", "2"="-1", "3"="1", "4"="1", "5"="1", "6"="1"))

# Party.
#supersom$party <- factor(supersom$cb10, levels=c(1:7, 10:13, 30), labels=c("Vänsterpartiet", "Socialdemokraterna", "Centerpartiet", "Liberalerna", "Moderaterna", "Kristdemokraterna", "Miljöpartiet", "Sverigedemokraterna", "Feministiskt initiativ", "Piratpartiet", "Ny demokrati", "Övriga"), ordered=FALSE)
supersom$party <- factor(supersom$cb10, levels=c(1:7, 10:13, 30), labels=c("Left Party (V)", "Social Democrats (S)", "Centre Party (C)", "Liberals (L)", "Moderate Party (M)", "Christian Democrats (KD)", "Green Party (MP)", "Sweden Democrats (SD)", "Feminist Initiative (FI)", "Pirate Party (PP)", "New Democracy (NyD)", "Other"), ordered=FALSE)
supersom$partysymbol <- factor(supersom$cb10, levels=c(1:7, 10:13, 30), labels=c("V", "S", "C", "L", "M", "KD", "MP", "SD", "FI", "PP", "NyD", "Other"), ordered=FALSE)

PartyColor <- unlist(list(V = "#DA291C",
                   S = "#E8112d",
                   C = "#009933",
                   L = "#006AB3",
                   M = "#52BDEC",
                   KD = "#000077",
                   MP = "#83CF39",
                   SD = "#DDDD00",
                   FI = "#CD1B68",
                   PP = "#572B85",
                   NyD = "#572B85",
                   Other = "#CCCCCC"), use.names=FALSE)

# Ideological extremism (center = 0, toward left/right = 2)
supersom$polextreme <- supersom$ideology %>% recode("1"="2", "2"="1", "3"="0", "4"="1", "5"="2") %>% as.numeric()

# Strong supporter of party?
supersom$partystrength <- supersom$cb20 %>% recode("1"="2", "2"="1", "3"="0")
supersom$partystrength <- factor(supersom$partystrength, levels=c(0,1,2), labels=c("No party supporter", "Weak party supporter", "Strong party supporter"), ordered=FALSE)

# Political leaning: left/center/right.
supersom$leaning <- supersom$ideology %>% recode("1"="1", "2"="1", "3"="2", "4"="3", "5"="3")
supersom$leaning <- factor(supersom$leaning, levels=c(1,2,3), labels=c("Left", "Center", "Right"), ordered=FALSE)
supersom$leaning.num <- as.numeric(supersom$ideology %>% recode("1"="-2", "2"="-1", "3"="0", "4"="1", "5"="2"))

# Factor sex.
supersom$sex <- factor(supersom$sex, levels=c(1, 2), labels=c("Female", "Male"), ordered=FALSE)

# Convert year to date yyyy-mm-dd.
supersom$date <- as.Date(paste(supersom$year, "-01-01", sep=""))

0.1.2 Affect

Calculate feelings towards other parties by subtracting feelings toward out-parties from feelings toward the in-party.

Since there are multiple out-parties, add them all together and average them.

# Like own party & dislike other parties.
supersom$C <- supersom$cb50a
supersom$M <- supersom$cb50b
supersom$V <- supersom$cb50c
supersom$L <- supersom$cb50d
supersom$S <- supersom$cb50e
supersom$MP <- supersom$cb50f
supersom$KD <- supersom$cb50g
#supersom$Nydemok <- supersom$cb50h
supersom$FI <- supersom$cb50i
supersom$SD <- supersom$cb50m
supersom$likeindex <- colSums(rbind(supersom$C, supersom$M, supersom$V, supersom$L, supersom$S, supersom$MP, supersom$KD, supersom$SD, supersom$FI), na.rm = TRUE)

# Add all affects from 9 parties.
supersom$affect <- colSums(rbind(supersom$C, supersom$M, supersom$V, supersom$L, supersom$S, supersom$MP, supersom$KD, supersom$SD), na.rm = TRUE)

# Subtract in-party from total affect (leaving only out-party affect), and then average the out-party affect.
supersom$affect.outparty <- if_else(supersom$partysymbol == "S", (supersom$affect - supersom$S) / 8, supersom$affect)
supersom$affect.outparty <- if_else(supersom$partysymbol == "M", (supersom$affect - supersom$M) / 8, supersom$affect.outparty)
supersom$affect.outparty <- if_else(supersom$partysymbol == "V", (supersom$affect - supersom$V) / 8, supersom$affect.outparty)
supersom$affect.outparty <- if_else(supersom$partysymbol == "MP", (supersom$affect - supersom$MP) / 8, supersom$affect.outparty)
supersom$affect.outparty <- if_else(supersom$partysymbol == "KD", (supersom$affect - supersom$KD) / 8, supersom$affect.outparty)
supersom$affect.outparty <- if_else(supersom$partysymbol == "C", (supersom$affect - supersom$C) / 8, supersom$affect.outparty)
supersom$affect.outparty <- if_else(supersom$partysymbol == "L", (supersom$affect - supersom$L) / 8, supersom$affect.outparty)
#supersom$affect.outparty <- if_else(supersom$partysymbol == "SD", (supersom$affect - supersom$SD) / 8, supersom$affect.outparty)

# Make new variable for in-party affect.
supersom$affect.inparty <- if_else(supersom$partysymbol == "S", supersom$S, supersom$affect)
supersom$affect.inparty <- if_else(supersom$partysymbol == "M", supersom$M, supersom$affect.inparty)
supersom$affect.inparty <- if_else(supersom$partysymbol == "V", supersom$V, supersom$affect.inparty)
supersom$affect.inparty <- if_else(supersom$partysymbol == "MP", supersom$MP, supersom$affect.inparty)
supersom$affect.inparty <- if_else(supersom$partysymbol == "KD", supersom$KD, supersom$affect.inparty)
supersom$affect.inparty <- if_else(supersom$partysymbol == "C", supersom$C, supersom$affect.inparty)
supersom$affect.inparty <- if_else(supersom$partysymbol == "L", supersom$L, supersom$affect.inparty)
#supersom$affect.inparty <- if_else(supersom$partysymbol == "SD", supersom$SD, supersom$affect.inparty)

# Onl keep parties in parliament.
supersom$affect.inparty[!supersom$partysymbol %in% c("S", "M", "V", "MP", "KD", "C", "L")] <- NA
supersom$affect.outparty[!supersom$partysymbol %in% c("S", "M", "V", "MP", "KD", "C", "L")] <- NA

0.1.3 Issue positions

supersom$jobmarket <- dummy(supersom$db900i, one=c(1, 2), zero=c(4, 5), labels=c("Agree", "Disagree"))
supersom$privatehealthcare <- dummy(supersom$ed900a, one=c(1, 2), zero=c(4, 5), labels=c("Agree", "Disagree"))
supersom$economy.change <- dummy(supersom$da11c, one=c(1:2), zero=c(4:5), labels=c("Better", "Worse"))

supersom$economy.politics <- dummy(supersom$cd110l, one=c(1:2), zero=c(4:5), labels=c("Good", "Bad"))
supersom$marry <- dummy(supersom$fc10e, one=c(1, 2, 3), zero=c(4), labels=c("Agree", "Disagree")) # "I would not like immigrant marriying family member."
supersom$womendiscrimination <- dummy(supersom$bb100b, one=c(6:10), zero=c(0:4), labels=c("Agree", "Disagree")) # "Women are often discriminated against on the job market"

0.1.4 Public service index

Create a additive public service index, with the use of Rapport/Aktuellt/Ekot which is then averaged.

Continous scale ranging from 1 (never) to 6 (daily).

# First, combine Aktuellt & Rapport (1986-2005). Use the highest frequency from either variable. In other words, if respondent use either Aktuellt or Rapport daily, then the value is daily.
# (Cumbersome coding because bug in case_when, see https://github.com/tidyverse/dplyr/issues/2927)
supersom$aktuelltrapport_early[supersom$aktuellt == 6 | supersom$aktuellt == 6] <- 6
supersom$aktuelltrapport_early[supersom$aktuellt == 5 | supersom$aktuellt == 5] <- 5
supersom$aktuelltrapport_early[supersom$aktuellt == 4 | supersom$aktuellt == 4] <- 4
supersom$aktuelltrapport_early[supersom$aktuellt == 3 | supersom$aktuellt == 3] <- 3
supersom$aktuelltrapport_early[supersom$aktuellt == 2 | supersom$aktuellt == 2] <- 2
supersom$aktuelltrapport_early[supersom$aktuellt == 1 | supersom$aktuellt == 1] <- 1

# Add to variable 1986-2004.
supersom$aktuelltrapport.combined[supersom$year <= 2004] <- supersom$aktuelltrapport_early[supersom$year <= 2004]

# Use the Aktuellt/Rapport measure from 2005 an onwards.
supersom$aktuelltrapport.combined[supersom$year >= 2005] <- supersom$jh10e[supersom$year >= 2005]

# Add values (Aktuellt and Rapport + Ekot) and divide by 2, thus creating a continous interval scale, from 1-6. 
supersom$psindex <- (supersom$aktuelltrapport.combined + supersom$ekot) / 2

# Reverse code index, so that 6=daily, 1=never.
supersom$psindex.rev <- min(supersom$psindex, na.rm=TRUE) + max(supersom$psindex, na.rm=TRUE) - supersom$psindex

library(sjlabelled)
set_label(supersom$psindex.rev, "label") <- "Public service index"

# Histogram of index.
ggplot(supersom, aes(psindex.rev)) +
  geom_histogram() +
  labs(title="Histogram of public service index",
       y="Count",
       x="Public service index (higher value = more frequent use)")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 14972 rows containing non-finite values (stat_bin).

library(moments)
mean(supersom$psindex.rev, na.rm=TRUE)
## [1] 3.687983
sd(supersom$psindex.rev, na.rm=TRUE)
## [1] 1.391549
skewness(supersom$psindex.rev, na.rm=TRUE)
## [1] 0.03896865
kurtosis(supersom$psindex.rev, na.rm=TRUE)
## [1] 2.114573

0.2 Swedish Television

0.2.1 SVT1

supersom %>%
  select(date, svt1.dich) %>%
  na.exclude() %>%
  group_by(date, svt1.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = (n / sum(n)) * 100) %>%
  ggplot(aes(date, percent, color=factor(svt1.dich))) +
    geom_line(size=1.2) +
    scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
    scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "bottom") +
    labs(title="Tittar på SVT", x="Year", y="Percent")

0.2.2 SVT1 & leaning

supersom %>%
  select(date, svt1.dich, leaning) %>%
  na.exclude() %>%
  group_by(leaning, date, svt1.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = n / sum(n) * 100) %>%
  ggplot(aes(date, percent, color=factor(svt1.dich))) +
    geom_line(size=1.2) + 
    scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
    scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "bottom", axis.text.x = element_text(angle=90)) +
    labs(title="SVT1 + leaning",
         x="Year",
         y="Percent") +
    facet_grid(~ leaning)

0.2.3 SVT1 & political interest

supersom %>%
  select(date, svt1.dich, polinterest) %>%
  na.exclude() %>%
  group_by(polinterest, date, svt1.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = n / sum(n) * 100) %>%
  ggplot(aes(date, percent, color=factor(svt1.dich))) +
    geom_line(size=1.2) + 
    #geom_smooth(method="lm") +
    scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
    scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "bottom", axis.text.x = element_text(angle=90)) +
    labs(title="SVT1 & political interest",
         x="Year",
         y="Percent") +
    facet_grid(~ polinterest)

0.2.4 SVT1 & extremity

Are public service viewers more extreme in their views?

supersom %>%
  select(date, svt1.dich, polextreme) %>%
  na.exclude() %>%
  group_by(svt1.dich, date) %>%
  summarize(meanextremism = mean(polextreme, na.rm=TRUE)) %>%
  ggplot(aes(date, meanextremism, color=svt1.dich)) +
    geom_line(alpha=0.5) +
    geom_smooth(method="loess") +
    scale_y_continuous(labels=scales::comma) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "none", axis.text.x = element_text(angle=90)) +
    labs(title="SVT1 + ideological extremism",
         x="Year",
         y="Ideological extremism") +
    facet_grid(~ svt1.dich)

0.2.5 SVT2 & leaning

supersom %>%
  select(date, svt2.dich, leaning) %>%
  na.exclude() %>%
  group_by(leaning, date, svt2.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = n / sum(n) * 100) %>%
  ggplot(aes(date, percent, color=factor(svt2.dich))) +
    geom_line(size=1.2) + 
    scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
    scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "bottom", axis.text.x = element_text(angle=90)) +
    labs(title="SVT2 + leaning",
         x="Year",
         y="Percent") +
    facet_grid(~ leaning)

0.2.6 SVT2 & political interest

supersom %>%
  select(date, svt2.dich, polinterest) %>%
  na.exclude() %>%
  group_by(polinterest, date, svt2.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = n / sum(n) * 100) %>%
  ggplot(aes(date, percent, color=factor(svt2.dich))) +
  geom_line(size=1.2) + 
  #geom_smooth(method="lm") +
  scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
  scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
  scale_x_date(date_label="%Y", date_breaks="2 year") + 
  theme(legend.position = "bottom", axis.text.x = element_text(angle=90)) +
  labs(title="SVT2 + political interest",
       x="Year",
       y="Percent") +
  facet_grid(~ polinterest)

Swedish Television news programmes Rapport and Aktuellt in SVT1 and SVT2, respectively.

0.2.7 Rapport & leaning

supersom %>%
  select(date, rapport.dich, leaning) %>%
  na.exclude() %>%
  group_by(leaning, date, rapport.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = n / sum(n) * 100) %>%
  ggplot(aes(date, percent, color=factor(rapport.dich))) +
    geom_line(size=1.2) + 
    scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
    scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "bottom", axis.text.x = element_text(angle=90)) +
    labs(title="Use SVT Rapport",
         x="Year",
         y="Percent") +
    facet_grid(~ leaning)

0.2.8 Rapport & political interest

supersom %>%
  select(date, rapport.dich, polinterest) %>%
  na.exclude() %>%
  group_by(polinterest, date, rapport.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = n / sum(n) * 100) %>%
  ggplot(aes(date, percent, color=factor(rapport.dich))) +
    geom_line(size=1.2) + 
    #geom_smooth(method="lm") +
    scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
    scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "bottom", axis.text.x = element_text(angle=90)) +
    labs(title="Use SVT Rapport",
         x="Year",
         y="Percent") +
    facet_grid(~ polinterest)

0.2.9 Aktuellt & leaning

supersom %>%
  select(date, aktuellt.dich, leaning) %>%
  na.exclude() %>%
  group_by(leaning, date, aktuellt.dich) %>%
  summarize(n = n()) %>%
  mutate(percent = n / sum(n) * 100) %>%
  ggplot(aes(date, percent, color=factor(aktuellt.dich))) +
    geom_line(size=1.2) + 
    scale_color_manual(values = c("#000000", "#CCCCCC"), name=NULL) +
    scale_y_continuous(labels=scales::comma, limit=c(0, 100)) +
    scale_x_date(date_label="%Y", date_breaks="2 year") + 
    theme(legend.position = "bottom", axis.text.x = element_text(angle=90)) +
    labs(title="Use Aktuellt",
         x="Year",
         y="Percent") +
    facet_grid(~ leaning)