| % Generated by roxygen2: do not edit by hand |
| % Please edit documentation in R/cacheAs.R |
| \name{withCachedResults} |
| \alias{withCachedResults} |
| \title{Take cached results as they are for the duration of an expression} |
| \usage{ |
| withCachedResults(expr, mode = c("reuse", "offline")) |
| } |
| \arguments{ |
| \item{expr}{the code to evaluate} |
| |
| \item{mode}{\code{"reuse"} to take what the files hold, \code{"offline"} to refuse |
| computing anything that is not in one already} |
| } |
| \value{ |
| the value of \code{expr} |
| } |
| \description{ |
| Sets the cacheAs mode (see \link{cacheAs}) while \code{expr} is evaluated and puts it |
| back afterwards, so that a whole document can be knitted from the files that |
| are there, without a stray \code{options()} call outliving it. |
| } |
| \examples{ |
| \dontrun{ |
| withCachedResults({ |
| ca <- KorAPConnection() |> collocationAnalysis("Klima", cacheAs = "klima.rds") |
| freq <- KorAPConnection() |> frequencyQuery("Klima", cacheAs = "klima-freq.rds") |
| }) |
| } |
| |
| } |
| \seealso{ |
| Other cacheAs: |
| \code{\link[=blessCacheAs]{blessCacheAs()}}, |
| \code{\link[=cacheAsInfo]{cacheAsInfo()}} |
| } |
| \concept{cacheAs} |