#Load functions and set working directory
source("I:/ABT1/_Datenablage/3_R-Skripte/SGB_data_prep_functions.R")
library(gsgb)
library(knitr)
library(flextable) #für Word-Tabellen im SGB-Layout
library(officer)   #für Word-Tabellen im SGB-Layout

#Set up general knitr options
knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE, fig.width=4, fig.height=2.5, dpi=600)
# Working directory in knitr (uncomment next line if desired)
# knitr::opts_knit$set(root.dir="I:/ABT1/_Datenablage/3_R-Skripte/rmarkdown-Vorlagen")

# Set SGB ggplot theme
th <- theme_sgb()
theme_set(th)

# flextable SGB theme function
flextable_sgb <- function(x){
  x <- flextable(x)
  x <- colformat_num(x, big.mark="'", digits=0)
  x <- border_remove(x = x) 
  x <- bold(x, part="header")
  sb  <- fp_border(color="black", width=1)
  x <- hline_top(x, border=sb, part="header" )
  x <- hline_top(x, border=sb, part="body" )
  x <- hline_bottom(x, border=sb, part="body")
  return(x)
}

# Speicherort .rda-Dateien festlegen
wd_rda  <- "I:/ABT1/_Datenablage/1_Aufbereitete_Daten/rda/"       
wd_predictions <- "I:/ABT1/_Datenablage/5_Prognosen/rda/"

Weshalb scheiterte die BGI?

1. Wenig Unterstüzung ausserhalb der SVP

2. Starke Gegenmobilisierung

::: notes This is a speaker note.

Plot Titel

ggplot(data=iris,aes(x=Sepal.Length, y=Sepal.Width, col=Species)) + 
  geom_point()+
  labs(x="Length",y="Width")+
  scale_colour_manual(values = usecol(pal = pal_sgb_pref))

ggsave(file="plot.png")

Plot aus externer Datei

Quelle: Fisher, R. A. (1936)

knitr-Tabelle

tab <- matrix((1:8)*1000, ncol=4)
tab <- as.data.frame(tab)
rn <- c("a","b")
tab <-data.frame(rn, tab)
names(tab) <- c(" ",letters[1:4])
kable(tab, digits = 1, format.args = list(big.mark = "'", scientific = FALSE))

flextab-Tabelle

tab <- matrix((1:8)*1000, ncol=4)
tab <- as.data.frame(tab)
rn <- c("a","b")
tab <- data.frame(rn, tab)
names(tab) <- c(" ",letters[1:4])
flextable_sgb(tab)


SchweizerischerGewerkschaftsbund/gsgb documentation built on Dec. 18, 2021, 1 p.m.