drake (version 6.2.1)

knitr_deps: Find the drake dependencies of a dynamic knitr report target.

Description

To enable drake to watch for the dependencies of a knitr report, the command in your workflow plan data frame must call knitr::knit() directly. In other words, the command must look something like knit("your_report.Rmd") or knit("your_report.Rmd", quiet = TRUE).

Usage

knitr_deps(target)

Arguments

target

file path to the file or name of the file target, source text of the document.

Value

A character vector of the names of dependencies.

Details

drake looks for dependencies in the document by analyzing evaluated code chunks for other targets/imports mentioned in loadd() and readd().

See Also

deps_code(), make(), load_mtcars_example()

Examples

Run this code
# NOT RUN {
test_with_dir("Quarantine side effects.", {
load_mtcars_example() # Get the code with drake_example("mtcars").
knitr_deps("'report.Rmd'") # Files must be single-quoted.
# Find the dependencies of the compiled output target, 'report.md'.
knitr_deps("report.Rmd")
make(my_plan) # Run the project.
# Work only on the Rmd source, not the output.
try(knitr_deps("'report.md'"), silent = FALSE) # error
})
# }

Run the code above in your browser using DataCamp Workspace