Add as.alternative parameter to frequencyQuery method
And also rename "tokens" to the more generic "total" in the result
tibble.
Change-Id: Iae2ec16307f993e5b95792f2f66c6a38dc9ff67d
diff --git a/man/KorAPQuery-class.Rd b/man/KorAPQuery-class.Rd
index 2f343f6..7749151 100644
--- a/man/KorAPQuery-class.Rd
+++ b/man/KorAPQuery-class.Rd
@@ -34,7 +34,7 @@
verbose = kqo@korapConnection@verbose)
\S4method{frequencyQuery}{KorAPConnection}(kco, query, vc = "",
- conf.level = 0.95, ...)
+ conf.level = 0.95, as.alternatives = FALSE, ...)
\method{format}{KorAPQuery}(x, ...)
@@ -79,6 +79,8 @@
\item{conf.level}{confidence level of the returned confidence interval (passed throgh \code{\link{ci}} to \code{\link{prop.test}}).}
+\item{as.alternatives}{LOGICAL that specifies if the query terms should be treated as alternatives. If \code{as.alternatives} is TRUE, the sum over all query hits, instead of the respective vc token sizes is used as total for the calculation of relative frequencies.}
+
\item{...}{further arguments passed to or from other methods}
\item{x}{KorAPQuery object}
diff --git a/man/ci.Rd b/man/ci.Rd
index 381adb0..ee6e18d 100644
--- a/man/ci.Rd
+++ b/man/ci.Rd
@@ -4,7 +4,7 @@
\alias{ci}
\title{Add confidence interval and relative frequency variables}
\usage{
-ci(df, x = totalResults, N = tokens, conf.level = 0.95)
+ci(df, x = totalResults, N = total, conf.level = 0.95)
}
\arguments{
\item{df}{table with columns for absolute and total frequencies.}
@@ -27,7 +27,7 @@
kco <- new("KorAPConnection", verbose=TRUE)
expand_grid(year=2015:2018, alternatives=c("Hate Speech", "Hatespeech")) \%>\%
bind_cols(corpusQuery(kco, .$alternatives, sprintf("pubDate in \%d", .$year))) \%>\%
- mutate(tokens=corpusStats(kco, vc=vc)$tokens) \%>\%
+ mutate(total=corpusStats(kco, vc=vc)$tokens) \%>\%
ci() \%>\%
ggplot(aes(x=year, y=f, fill=query, color=query, ymin=conf.low, ymax=conf.high)) +
geom_point() + geom_line() + geom_ribbon(alpha=.3)