fix errors from refactoring and add documentation to all remaining functions in analyze.R

This commit is contained in:
2021-08-07 00:31:56 +02:00
parent 5f9343bf7f
commit 5e9f70627d
10 changed files with 237 additions and 16 deletions
+54
View File
@@ -0,0 +1,54 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/analyze.R
\name{bar_plot_fractions}
\alias{bar_plot_fractions}
\title{plot data depending on fractions in a standardized, configurable way}
\usage{
bar_plot_fractions(
tb,
x_variable = NULL,
y_variable = NULL,
fill = NULL,
title = NULL,
xlab = "Fraction",
ylab = "n",
filllab = "Fraction",
flipped = TRUE,
position = "dodge",
reorder = FALSE
)
}
\arguments{
\item{tb}{tibble}
\item{x_variable}{column in tb}
\item{y_variable}{column in tb}
\item{fill}{column in tb}
\item{title}{char}
\item{xlab}{char}
\item{ylab}{char}
\item{filllab}{char}
\item{flipped}{bool}
\item{position}{char}
\item{reorder}{bool
plot data from tb in the following way: for each item in x_variable show the corresponding value in y_variable.
Then color the plot depending on the fill value
Give the plot a title, an x-label xlab as well as an y-label ylab
Color the legend according to filllab
Setting flipped to TRUE makes the bars horizontal
Improve positioning details according to position
and finally reorder x_variable (default ist to order fractions according to seat order)}
}
\description{
plot data depending on fractions in a standardized, configurable way
}
+18
View File
@@ -0,0 +1,18 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/analyze.R
\name{find_word}
\alias{find_word}
\title{Count number of occurences of a given word}
\usage{
find_word(res, word)
}
\arguments{
\item{res}{tibble}
\item{word}{character
Add number of occurences of word to talks}
}
\description{
Count number of occurences of a given word
}
+21
View File
@@ -0,0 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/analyze.R
\name{join_speaker}
\alias{join_speaker}
\title{add information from speaker table to a tibble containing speaker id}
\usage{
join_speaker(tb, res, fraction_only = F)
}
\arguments{
\item{tb}{tibble}
\item{res}{tibble}
\item{fraction_only}{bool
left join speaker information from res$speaker into tb.
if fraction_only is TRUE, only fraction is selected from the resulting joined tibble}
}
\description{
add information from speaker table to a tibble containing speaker id
}
+24
View File
@@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/repair.R
\name{lookup_speaker}
\alias{lookup_speaker}
\title{Lookup name in speakers table}
\usage{
lookup_speaker(tb, speaker, name_variable)
}
\arguments{
\item{tb}{tibble}
\item{speaker}{tibble}
\item{name_variable}{name
Tries to match the name_variable column with speaker names
returns a lookup table}
}
\description{
Tries to find the correct speaker id given a name.
This is sufficient since every prename lastname combination in the bundestag is
unique (luckily :D)
}
+16
View File
@@ -0,0 +1,16 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/analyze.R
\docType{data}
\name{party_colors}
\alias{party_colors}
\title{lookup table for party colors}
\format{
An object of class \code{character} of length 8.
}
\usage{
party_colors
}
\description{
lookup table for party colors
}
\keyword{datasets}
+11 -1
View File
@@ -4,7 +4,17 @@
\alias{repair}
\title{Repair parsed tables}
\usage{
repair(parse_output)
repair(parse_output, repair_comments = FALSE)
}
\arguments{
\item{parse_output}{tibble}
\item{repair_comments}{bool
If repair_comments is TRUE, members of the parliament mentioned in comments are looked up in speaker table.
Possible test: check identical(repair(res), repair(repair(res))) == TRUE
Since repaired tables should be a fixpoint of repair.}
}
\description{
Repair parsed tables
+23
View File
@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/analyze.R
\name{word_usage_by_date}
\alias{word_usage_by_date}
\title{Counts how many talks do match a given pattern and summarises by date}
\usage{
word_usage_by_date(res, patterns, name, tidy = F)
}
\arguments{
\item{res}{tibble}
\item{patterns}{char list}
\item{name}{char ? what is name needed for??}
\item{tidy}{bool, default F
shorter summary if tidy=F
if tidy is set to T, the resulting tibble is tidy}
}
\description{
Counts how many talks do match a given pattern and summarises by date
}