blob: 9f934e6c492e433cd03d972567b8edb427046708 [file] [log] [blame]
Marc Kupietzad8d2ed2025-04-05 15:37:38 +02001% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/KorAPQuery.R
3\name{frequencyQuery,KorAPConnection-method}
4\alias{frequencyQuery,KorAPConnection-method}
5\alias{frequencyQuery}
6\title{Query frequencies of search expressions in virtual corpora}
7\usage{
8\S4method{frequencyQuery}{KorAPConnection}(
9 kco,
10 query,
11 vc = "",
12 conf.level = 0.95,
13 as.alternatives = FALSE,
14 ...
15)
16}
17\arguments{
18\item{kco}{\code{\link[=KorAPConnection]{KorAPConnection()}} object (obtained e.g. from \code{KorAPConnection()}}
19
20\item{query}{corpus query string(s.) (can be a vector). The query language depends on the \code{ql} parameter. Either \code{query} must be provided or \code{KorAPUrl}.}
21
22\item{vc}{virtual corpus definition(s) (can be a vector)}
23
24\item{conf.level}{confidence level of the returned confidence interval (passed through \code{\link[=ci]{ci()}} to \code{\link[=prop.test]{prop.test()}}).}
25
26\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.}
27
28\item{...}{further arguments passed to or from other methods (see \code{\link[=corpusQuery]{corpusQuery()}}), most notably \code{expand}, a logical that decides if \code{query} and \code{vc} parameters are expanded to all of their combinations. It defaults to \code{TRUE}, if \code{query} and \code{vc} have different lengths, and to \code{FALSE} otherwise.}
29}
30\value{
31A tibble, with each row containing the following result columns for query and vc combinations:
32\itemize{
33\item \strong{query}: the query string used for the frequency analysis.
34\item \strong{totalResults}: absolute frequency of query matches in the vc.
35\item \strong{vc}: virtual corpus used for the query.
36\item \strong{webUIRequestUrl}: URL of the corresponding web UI request with respect to query and vc.
37\item \strong{total}: total number of words in vc.
38\item \strong{f}: relative frequency of query matches in the vc.
39\item \strong{conf.low}: lower bound of the confidence interval for the relative frequency, given \code{conf.level}.
40\item \strong{conf.high}: upper bound of the confidence interval for the relative frequency, given \code{conf.level}.
41}
42}
43\description{
44\strong{\code{frequencyQuery}} combines \code{\link[=corpusQuery]{corpusQuery()}}, \code{\link[=corpusStats]{corpusStats()}} and
45\code{\link[=ci]{ci()}} to compute a tibble with the absolute and relative frequencies and
46confidence intervals of one ore multiple search terms across one or multiple
47virtual corpora.
48}
49\examples{
50\dontrun{
51
52KorAPConnection(verbose = TRUE) |>
53 frequencyQuery(c("Mücke", "Schnake"), paste0("pubDate in ", 2000:2003))
54}
55
56}