blob: 33458bc708bda796d6af8bf1f35d0a2866aaa91c [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,
Marc Kupietza3a8cd92026-09-08 07:59:04 +020014 cacheAs = NULL,
Marc Kupietzad8d2ed2025-04-05 15:37:38 +020015 ...
16)
17}
18\arguments{
19\item{kco}{\code{\link[=KorAPConnection]{KorAPConnection()}} object (obtained e.g. from \code{KorAPConnection()}}
20
21\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}.}
22
23\item{vc}{virtual corpus definition(s) (can be a vector)}
24
25\item{conf.level}{confidence level of the returned confidence interval (passed through \code{\link[=ci]{ci()}} to \code{\link[=prop.test]{prop.test()}}).}
26
27\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.}
28
Marc Kupietza3a8cd92026-09-08 07:59:04 +020029\item{cacheAs}{path to an RDS file to keep the result in. If the file exists and records the same call, it is read back instead of contacting the server; otherwise the query is run and its result stored there. Unlike the connection's \code{cache}, this file belongs to the caller, which is what keeps an analysis reproducible once the corpus has grown or the scores have changed. Defaults to \code{NULL} (no file).}
30
Marc Kupietzad8d2ed2025-04-05 15:37:38 +020031\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.}
32}
33\value{
34A tibble, with each row containing the following result columns for query and vc combinations:
35\itemize{
36\item \strong{query}: the query string used for the frequency analysis.
37\item \strong{totalResults}: absolute frequency of query matches in the vc.
38\item \strong{vc}: virtual corpus used for the query.
Marc Kupietz10eff992026-09-14 08:31:41 +020039\item \strong{queryDuration}: client-side duration of the request in seconds.
Marc Kupietzad8d2ed2025-04-05 15:37:38 +020040\item \strong{webUIRequestUrl}: URL of the corresponding web UI request with respect to query and vc.
41\item \strong{total}: total number of words in vc.
42\item \strong{f}: relative frequency of query matches in the vc.
43\item \strong{conf.low}: lower bound of the confidence interval for the relative frequency, given \code{conf.level}.
44\item \strong{conf.high}: upper bound of the confidence interval for the relative frequency, given \code{conf.level}.
45}
46}
47\description{
48\strong{\code{frequencyQuery}} combines \code{\link[=corpusQuery]{corpusQuery()}}, \code{\link[=corpusStats]{corpusStats()}} and
49\code{\link[=ci]{ci()}} to compute a tibble with the absolute and relative frequencies and
50confidence intervals of one ore multiple search terms across one or multiple
51virtual corpora.
52}
53\examples{
54\dontrun{
55
56KorAPConnection(verbose = TRUE) |>
57 frequencyQuery(c("Mücke", "Schnake"), paste0("pubDate in ", 2000:2003))
58}
59
60}
Marc Kupietza8c40f42025-06-24 15:49:52 +020061\concept{frequency analysis}