From 1546f84d801c08cd376c19d9be4c334a4c2d73fa Mon Sep 17 00:00:00 2001 From: Leon Burgard Date: Sun, 8 Aug 2021 20:32:28 +0200 Subject: [PATCH] update README --- README.md | 111 +++++++++++++++++++++++++++++++++++++- vignettes/funwithdata.Rmd | 1 + 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb465e8..cfe9e21 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,115 @@ # How to develop -Wie kann man entwickeln? +```r +# everything works with devtools (loads some other packages too) +library(devtools) + +# reload all package functions +load_all() + +#write to CSV files to speed up loading +tables <- read_all() +tables <- repair(tables) +write_to_csv(tables) +``` +We NEVER use source(...), etc.! Also NEVER use library(...). +But to add new packages (as dependency), use: +```r +use_package("my-good-old-package") +``` +To make package imports available, you have to add them to `R/hateimparlament-package.R` +as `@import `. + +To reload / create documentation (calls roxygen) +```r +document() +``` + +Build vignettes +```r +rmarkdown::render("vignettes/bla.Rmd") +``` + +# Download + +Before parsing, fetch.R must be run to download all protocols. +```r +fetch_all("../inst/records/") # path to directory where records should be stored +``` + +# Parsing + +## tables + +parse.R parses all downloaded logs and creates 5 tibbles. +repair.R then cleans up the errors in these tibbles. +```r +read_all("../inst/records/") %>% repair() +``` + + + +### Speaker + +structure: `id` , `first_name` , `last_name` , `fraction` , `title` , `role_short`, `role_long`. + + + +Obtained from the `` entry at the end of the transcripts. + +### Speeches + +Structure: `id` , `speaker` + +The speeches `id` is specified in the protocol and is unique.A speech is a `` entry in the session history. A speech always has a main speaker (the one standing at the front of the lectern). + +Within a speech, there can be different speech entries: + +- Comments: Applause, interjections, etc. +- Speeches: Typically mainly the main speaker, but also interjections. +These are stored in the talks, comments and applause tables when parsing. + + +### Talks + +Structure: `speech_id` , `speaker` , `content`. + +These are the actual talk entries that appear within _speeches_. + +- `speech_id`: the speech in which the contribution appears. +- `speaker`: The speaker of the speech entry. +- `content`: The content of the speech. + +###comments + +These are the interjections that appear during the speeches. + +They have the following structure: +- `speech_id`: The speech that was interrupted. +- `on_speaker`: The speaker who was interrupted. +- `fraction` +- `commenter`: The person who interrupted the speech. +- `comment`: The content of the comment. + +###applause + +The logical table shows which party applauded for which speaker with explicit speech and which did not. + +structure: `speech_id`, `on_speaker`, `CDU_CSU`, `SPD`, `FDP`, `DIE_LINKE`, `BUENDNIS_90_DIE_GRUENEN`, `AfD` + + +# Analysis + +analysis.R provides some functions to analyze the "Plenarprotokolle" and to create plots. + +In the vignettes you can find different analyses of the protocols. + + + +____________________________________________________________________________ + + +# How to develop ```r # alles geht mit devtools (laedt auch noch ein paar andere pakete) diff --git a/vignettes/funwithdata.Rmd b/vignettes/funwithdata.Rmd index db0c74e..51950df 100644 --- a/vignettes/funwithdata.Rmd +++ b/vignettes/funwithdata.Rmd @@ -45,6 +45,7 @@ comments <- res$comments speeches <- res$speeches speaker <- res$speaker talks <- res$talks +applause <- res$applause ``` ## Analysis