blob: 03e4223b0bb7d1ae950dd6a39b37f48967ad190e [file] [log] [blame]
Marc Kupietzc3de7022026-09-08 14:08:12 +02001% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/cacheAs.R
3\name{withCachedResults}
4\alias{withCachedResults}
5\title{Take cached results as they are for the duration of an expression}
6\usage{
7withCachedResults(expr, mode = c("reuse", "offline"))
8}
9\arguments{
10\item{expr}{the code to evaluate}
11
12\item{mode}{\code{"reuse"} to take what the files hold, \code{"offline"} to refuse
13computing anything that is not in one already}
14}
15\value{
16the value of \code{expr}
17}
18\description{
19Sets the cacheAs mode (see \link{cacheAs}) while \code{expr} is evaluated and puts it
20back afterwards, so that a whole document can be knitted from the files that
21are there, without a stray \code{options()} call outliving it.
22}
23\examples{
24\dontrun{
25withCachedResults({
26 ca <- KorAPConnection() |> collocationAnalysis("Klima", cacheAs = "klima.rds")
27 freq <- KorAPConnection() |> frequencyQuery("Klima", cacheAs = "klima-freq.rds")
28})
29}
30
31}
32\seealso{
33Other cacheAs:
34\code{\link[=blessCacheAs]{blessCacheAs()}},
35\code{\link[=cacheAsInfo]{cacheAsInfo()}}
36}
37\concept{cacheAs}