Offer cacheAs on the other query functions as well

frequencyQuery(), corpusStats(), collocationScoreQuery() and
textMetadata() take a cacheAs file too now, not because they are slow -
they are not, next to a collocation analysis running for hours - but
because a file of one's own is what keeps an analysis reproducible. KorAP
corpora grow, so the same query returns different numbers next year, and
the scores computed from them may change with the package; a result kept
next to the script stays what it was, and the script runs without a
server at all.

The parameter is documented as what it is, next to the connection's
cache, which is a transparent speed-up one can throw away.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change-Id: I9bac8931e7a38a91adcbfe58ef4cb5bcdaaf3c47
diff --git a/man/collocationScoreQuery-KorAPConnection-method.Rd b/man/collocationScoreQuery-KorAPConnection-method.Rd
index b7ff06a..b6314fa 100644
--- a/man/collocationScoreQuery-KorAPConnection-method.Rd
+++ b/man/collocationScoreQuery-KorAPConnection-method.Rd
@@ -18,7 +18,8 @@
   smoothingConstant = 0.5,
   observed = NA,
   ignoreCollocateCase = FALSE,
-  withinSpan = "base/s=s"
+  withinSpan = "base/s=s",
+  cacheAs = NULL
 )
 }
 \arguments{
@@ -47,6 +48,8 @@
 \item{ignoreCollocateCase}{logical, set to TRUE if collocate case should be ignored}
 
 \item{withinSpan}{KorAP span specification (see \url{https://korap.ids-mannheim.de/doc/ql/poliqarp-plus?embedded=true#spans}) for collocations to be searched within. Defaults to \code{base/s=s}.}
+
+\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).}
 }
 \value{
 tibble with query KorAP web request URL, all observed values and association scores
diff --git a/man/corpusStats-KorAPConnection-method.Rd b/man/corpusStats-KorAPConnection-method.Rd
index 74ba851..7e576ce 100644
--- a/man/corpusStats-KorAPConnection-method.Rd
+++ b/man/corpusStats-KorAPConnection-method.Rd
@@ -5,7 +5,7 @@
 \alias{corpusStats}
 \title{Get corpus size and statistics}
 \usage{
-\S4method{corpusStats}{KorAPConnection}(kco, vc = "", verbose = kco@verbose, as.df = FALSE)
+\S4method{corpusStats}{KorAPConnection}(kco, vc = "", verbose = kco@verbose, as.df = FALSE, cacheAs = NULL)
 }
 \arguments{
 \item{kco}{\code{\link[=KorAPConnection]{KorAPConnection()}} object (obtained e.g. from \code{KorAPConnection()}}
@@ -15,6 +15,8 @@
 \item{verbose}{logical. If \code{TRUE}, additional diagnostics are printed.}
 
 \item{as.df}{return result as data frame instead of as S4 object?}
+
+\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).}
 }
 \value{
 Object containing corpus statistics with the following information:
diff --git a/man/frequencyQuery-KorAPConnection-method.Rd b/man/frequencyQuery-KorAPConnection-method.Rd
index cc9c361..5ae060a 100644
--- a/man/frequencyQuery-KorAPConnection-method.Rd
+++ b/man/frequencyQuery-KorAPConnection-method.Rd
@@ -11,6 +11,7 @@
   vc = "",
   conf.level = 0.95,
   as.alternatives = FALSE,
+  cacheAs = NULL,
   ...
 )
 }
@@ -25,6 +26,8 @@
 
 \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{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).}
+
 \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.}
 }
 \value{
diff --git a/man/textMetadata-KorAPConnection-method.Rd b/man/textMetadata-KorAPConnection-method.Rd
index aadbee3..5f1f462 100644
--- a/man/textMetadata-KorAPConnection-method.Rd
+++ b/man/textMetadata-KorAPConnection-method.Rd
@@ -5,7 +5,7 @@
 \alias{textMetadata}
 \title{Retrieve metadata for a text, identified by its sigle (id)}
 \usage{
-\S4method{textMetadata}{KorAPConnection}(kco, textSigle, verbose = kco@verbose)
+\S4method{textMetadata}{KorAPConnection}(kco, textSigle, verbose = kco@verbose, cacheAs = NULL)
 }
 \arguments{
 \item{kco}{\code{\link[=KorAPConnection]{KorAPConnection()}} object (obtained e.g. from \code{KorAPConnection()})}
@@ -13,6 +13,8 @@
 \item{textSigle}{unique text id (concatenation of corpus, document and text ids, separated by \code{/}, e.g. ) or vector thereof}
 
 \item{verbose}{logical. If \code{TRUE}, additional diagnostics are printed. Defaults to \code{kco@verbose}.}
+
+\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).}
 }
 \value{
 Tibble with columns for each metadata property. In case of errors, such as non-existing texts/sigles, the tibble will also contain a column called \code{errors}.