| Marc Kupietz | c3de702 | 2026-09-08 14:08:12 +0200 | [diff] [blame] | 1 | % 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{ |
| 7 | withCachedResults(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 |
| 13 | computing anything that is not in one already} |
| 14 | } |
| 15 | \value{ |
| 16 | the value of \code{expr} |
| 17 | } |
| 18 | \description{ |
| 19 | Sets the cacheAs mode (see \link{cacheAs}) while \code{expr} is evaluated and puts it |
| 20 | back afterwards, so that a whole document can be knitted from the files that |
| 21 | are there, without a stray \code{options()} call outliving it. |
| 22 | } |
| 23 | \examples{ |
| 24 | \dontrun{ |
| 25 | withCachedResults({ |
| 26 | ca <- KorAPConnection() |> collocationAnalysis("Klima", cacheAs = "klima.rds") |
| 27 | freq <- KorAPConnection() |> frequencyQuery("Klima", cacheAs = "klima-freq.rds") |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | } |
| 32 | \seealso{ |
| 33 | Other cacheAs: |
| 34 | \code{\link[=blessCacheAs]{blessCacheAs()}}, |
| 35 | \code{\link[=cacheAsInfo]{cacheAsInfo()}} |
| 36 | } |
| 37 | \concept{cacheAs} |