Add function frequencyQuery (corpusQuery + corpusStats + ci)

Change-Id: Icb7ed900ea588f606a812d1e3122867a81cefaa2
diff --git a/man/KorAPQuery-class.Rd b/man/KorAPQuery-class.Rd
index b5c9a8a..2a1fa8b 100644
--- a/man/KorAPQuery-class.Rd
+++ b/man/KorAPQuery-class.Rd
@@ -11,6 +11,8 @@
 \alias{fetchAll}
 \alias{fetchRest,KorAPQuery-method}
 \alias{fetchRest}
+\alias{frequencyQuery,KorAPConnection-method}
+\alias{frequencyQuery}
 \alias{format.KorAPQuery}
 \alias{show,KorAPQuery-method}
 \title{Class KorAPQuery}
@@ -31,6 +33,8 @@
 \S4method{fetchRest}{KorAPQuery}(kqo,
   verbose = kqo@korapConnection@verbose)
 
+\S4method{frequencyQuery}{KorAPConnection}(kco, query, vc = "", ...)
+
 \method{format}{KorAPQuery}(x, ...)
 
 \S4method{show}{KorAPQuery}(object)
@@ -68,10 +72,14 @@
 
 \item{verbose}{print progress information if true}
 
-\item{x}{KorAPQuery object}
+\item{kco}{\code{\link{KorAPConnection}} object (obtained e.g. from \code{new("KorAPConnection")}}
+
+\item{query}{string that contains the corpus query. The query language depends on the \code{ql} parameter. Either \code{query} must be provided or \code{KorAPUrl}.}
 
 \item{...}{further arguments passed to or from other methods}
 
+\item{x}{KorAPQuery object}
+
 \item{object}{KorAPQuery object}
 }
 \value{
@@ -80,6 +88,13 @@
 \description{
 \code{KorAPQuery} objetcs represent the current state of a query to a KorAP server.
 New \code{KorAPQuery} objects are typically created by the \code{\link{corpusQuery}} method.
+
+\bold{\code{fetchNext}} fetches the next bunch of results of a KorAP query.
+
+\bold{\code{frequencyQuery}} combines \code{\link{corpusQuery}}, \code{\link{corpusStats}} and
+\code{\link{ci}} to compute a table with the relative frequencies and
+confidence intervals of one ore multiple search terms across one or multiple
+virtual corpora.
 }
 \examples{
 q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchAll()
@@ -88,6 +103,9 @@
 q <- new("KorAPConnection") \%>\% corpusQuery("Ameisenplage") \%>\% fetchAll()
 q@collectedMatches
 
+new("KorAPConnection", verbose = TRUE) \%>\%
+  frequencyQuery(c("Mücke", "Schnake"), paste0("pubDate in ", 2000:2003))
+
 }
 \references{
 \url{https://ids-pub.bsz-bw.de/frontdoor/index/index/docId/9026}
diff --git a/man/ci.Rd b/man/ci.Rd
index e4f7e54..381adb0 100644
--- a/man/ci.Rd
+++ b/man/ci.Rd
@@ -18,8 +18,9 @@
 }
 \description{
 Using \code{\link{prop.test}}, \code{ci} adds three columns to a data frame:
-1. relative frequency (\code{f}) 2. lower bound of a confidence interval
-(\code{ci.low}) 3. upper bound of a confidence interval
+1. relative frequency (\code{f})
+2. lower bound of a confidence interval (\code{ci.low})
+3. upper bound of a confidence interval
 }
 \examples{
 library(ggplot2)
@@ -32,3 +33,6 @@
     geom_point() + geom_line() + geom_ribbon(alpha=.3)
 
 }
+\seealso{
+\code{ci} is alread included in \code{\link{frequencyQuery}}
+}
diff --git a/man/corpusQuery-KorAPConnection-method.Rd b/man/corpusQuery-KorAPConnection-method.Rd
index 49e636b..1368ee7 100644
--- a/man/corpusQuery-KorAPConnection-method.Rd
+++ b/man/corpusQuery-KorAPConnection-method.Rd
@@ -15,7 +15,8 @@
   "poliqarp", httr::parse_url(KorAPUrl)$query$ql),
   fields = c("corpusSigle", "textSigle", "pubDate", "pubPlace",
   "availability", "textClass", "snippet"), accessRewriteFatal = TRUE,
-  verbose = kco@verbose, as.df = FALSE)
+  verbose = kco@verbose, expand = length(vc) != length(query),
+  as.df = FALSE)
 }
 \arguments{
 \item{kco}{\code{\link{KorAPConnection}} object (obtained e.g. from \code{new("KorAPConnection")}}
@@ -36,10 +37,12 @@
 
 \item{verbose}{print some info}
 
+\item{expand}{logical that deicdes if \code{query} and \code{vc} parameters are expanded to all of their combinations}
+
 \item{as.df}{return result as data frame instead of as S4 object?}
 }
 \value{
-A \code{\link{KorAPQuery}} object that, among other information, contains the total number of results in \code{@totalResults}. The resulting object can be used to fetch all query results (with \code{\link{fetchAll}}) or the next page of results (with \code{\link{fetchNext}}).
+Depending on the \code{as.df} parameter, a table or a \code{\link{KorAPQuery}} object that, among other information, contains the total number of results in \code{@totalResults}. The resulting object can be used to fetch all query results (with \code{\link{fetchAll}}) or the next page of results (with \code{\link{fetchNext}}).
 A corresponding URL to be used within a web browser is contained in \code{@webUIRequestUrl}
 Please make sure to check \code{$collection$rewrites} to see if any unforseen access rewrites of the query's virtual corpus had to be performed.
 }