| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/cache.R |
| 3 |
\name{dep_auto} |
| 4 |
\alias{dep_auto} |
| 5 |
\title{Build automatic dependencies among chunks} |
| 6 |
\usage{ |
| 7 |
dep_auto(path = opts_chunk$get("cache.path"), labels = all_labels()) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{path}{Path to the dependency file.} |
| 11 |
|
| 12 |
\item{labels}{A vector of labels of chunks for which the dependencies will be |
| 13 |
built. By default, dependencies for all chunks will be built.} |
| 14 |
} |
| 15 |
\value{ |
| 16 |
\code{NULL}. The dependencies are built as a side effect. |
| 17 |
} |
| 18 |
\description{ |
| 19 |
When the chunk option \code{autodep = TRUE}, all names of objects created in |
| 20 |
a chunk will be saved in a file named \file{__objects} and all global objects |
| 21 |
used in a chunk will be saved to \file{__globals}. This function can analyze |
| 22 |
object names in these files to automatically build cache dependencies, which |
| 23 |
is similar to the effect of the \code{dependson} option. It is supposed to be |
| 24 |
used in the first chunk of a document and this chunk must not be cached. |
| 25 |
} |
| 26 |
\note{ |
| 27 |
Be cautious about \code{path}: because this function is used in a |
| 28 |
chunk, the working directory when the chunk is evaluated is the directory |
| 29 |
of the input document in \code{\link{knit}}, and if that directory differs |
| 30 |
from the working directory before calling \code{knit()}, you need to adjust |
| 31 |
the \code{path} argument here to make sure this function can find the cache |
| 32 |
files \file{__objects} and \file{__globals}. |
| 33 |
} |
| 34 |
\references{ |
| 35 |
\url{https://yihui.org/knitr/demo/cache/} |
| 36 |
} |
| 37 |
\seealso{ |
| 38 |
\code{\link{dep_prev}} |
| 39 |
} |