Last chance! 50% off unlimited learning
Sale ends in
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)
.
knitr_deps(target)
file path to the file or name of the file target, source text of the document.
A character vector of the names of dependencies.
Drake looks for dependencies in the document by
analyzing evaluated code chunks for other targets/imports
mentioned in loadd()
and readd()
.
# 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 DataLab