Vectorize corpusQuery and corpusStats

Change-Id: If2deeeeef2b2d64169dd21e5514dac6f8e458b32
diff --git a/man/corpusQuery-KorAPConnection-method.Rd b/man/corpusQuery-KorAPConnection-method.Rd
index e623297..49e636b 100644
--- a/man/corpusQuery-KorAPConnection-method.Rd
+++ b/man/corpusQuery-KorAPConnection-method.Rd
@@ -6,9 +6,16 @@
 \alias{corpusQuery}
 \title{Method corpusQuery}
 \usage{
-\S4method{corpusQuery}{KorAPConnection}(kco, query, vc = "", KorAPUrl,
-  metadataOnly = TRUE, ql = "poliqarp", fields = defaultFields,
-  accessRewriteFatal = TRUE, verbose = kco@verbose)
+\S4method{corpusQuery}{KorAPConnection}(kco,
+  query = ifelse(missing(KorAPUrl),
+  stop("At least one of the parameters query and KorAPUrl must be specified.",
+  call. = FALSE), httr::parse_url(KorAPUrl)$query$q),
+  vc = ifelse(missing(KorAPUrl), "", httr::parse_url(KorAPUrl)$query$cq),
+  KorAPUrl, metadataOnly = TRUE, ql = ifelse(missing(KorAPUrl),
+  "poliqarp", httr::parse_url(KorAPUrl)$query$ql),
+  fields = c("corpusSigle", "textSigle", "pubDate", "pubPlace",
+  "availability", "textClass", "snippet"), accessRewriteFatal = TRUE,
+  verbose = kco@verbose, as.df = FALSE)
 }
 \arguments{
 \item{kco}{\code{\link{KorAPConnection}} object (obtained e.g. from \code{new("KorAPConnection")}}
@@ -28,6 +35,8 @@
 \item{accessRewriteFatal}{abort if query or given vc had to be rewritten due to insufficent rights (not yet implemented).}
 
 \item{verbose}{print some info}
+
+\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}}).
@@ -55,12 +64,12 @@
   fetchAll() \%>\%
   slot("collectedMatches") \%>\%
   mutate(year = lubridate::year(pubDate)) \%>\%
-  dplyr::select(year) \%>\%
+  select(year) \%>\%
   group_by(year) \%>\%
   summarise(Count = n()) \%>\%
   mutate(Freq = mapply(function(f, y)
     f / corpusStats(kco, paste("pubDate in", y))@tokens, Count, year)) \%>\%
-  dplyr::select(-Count) \%>\%
+  select(-Count) \%>\%
   complete(year = min(year):max(year), fill = list(Freq = 0)) \%>\%
   plot(type = "l")
 
diff --git a/man/corpusStats-KorAPConnection-method.Rd b/man/corpusStats-KorAPConnection-method.Rd
index 486ee1c..8a13183 100644
--- a/man/corpusStats-KorAPConnection-method.Rd
+++ b/man/corpusStats-KorAPConnection-method.Rd
@@ -7,7 +7,7 @@
 \title{Fetch information about a (virtual) corpus}
 \usage{
 \S4method{corpusStats}{KorAPConnection}(kco, vc = "",
-  verbose = kco@verbose)
+  verbose = kco@verbose, as.df = FALSE)
 }
 \arguments{
 \item{kco}{\code{\link{KorAPConnection}} object (obtained e.g. from \code{new("KorAPConnection")}}
@@ -15,6 +15,8 @@
 \item{vc}{string describing the virtual corpus. An empty string (default) means the whole corpus, as far as it is license-wise accessible.}
 
 \item{verbose}{logical. If \code{TRUE}, additional diagnostics are printed.}
+
+\item{as.df}{return result as data frame instead of as S4 object?}
 }
 \value{
 \code{KorAPCorpusStats} object with the slots \code{documents}, \code{tokens}, \code{sentences}, \code{paragraphs}
diff --git a/man/reexports.Rd b/man/reexports.Rd
index 81287d2..b92085b 100644
--- a/man/reexports.Rd
+++ b/man/reexports.Rd
@@ -3,12 +3,16 @@
 \docType{import}
 \name{reexports}
 \alias{reexports}
+\alias{bind_cols}
 \alias{mutate}
 \alias{select}
 \alias{group_by}
 \alias{summarise}
 \alias{complete}
+\alias{expand_grid}
 \alias{year}
+\alias{as_tibble}
+\alias{tidy}
 \title{Objects exported from other packages}
 \keyword{internal}
 \description{
@@ -16,10 +20,14 @@
 below to see their documentation.
 
 \describe{
-  \item{dplyr}{\code{\link[dplyr]{mutate}}, \code{\link[dplyr]{select}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr]{summarise}}}
+  \item{broom}{\code{\link[broom]{tidy}}}
+
+  \item{dplyr}{\code{\link[dplyr]{bind_cols}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr]{select}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr]{summarise}}}
 
   \item{lubridate}{\code{\link[lubridate]{year}}}
 
-  \item{tidyr}{\code{\link[tidyr]{complete}}}
+  \item{tibble}{\code{\link[tibble]{as_tibble}}}
+
+  \item{tidyr}{\code{\link[tidyr]{complete}}, \code{\link[tidyr]{expand_grid}}}
 }}