Example R Markdown drake file target

Content

tryCatch({
  library(drake)
  loadd(fit)
  print(fit)
  readd(hist)
},
error = function(e) {
  stop("please read the instructions in the R Markdown file.")
})

Instructions

This file report.Rmd belongs to the example from this chapter of the user manual and drake_example("main"). The report does not compile from scratch because it is a file target in a drake-powered reproducible workflow (details here).

To compile this report,

  1. Name it report.Rmd (or modify the knitr_in("report.Rmd") line in make.R accordingly).
  2. Make sure the included file raw_data.xlsx is in your current working directory.
  3. Install the drake and tidyverse packages.
  4. Use make.R (included with this template) to run the drake workflow that compiles this report.

Step 3 not only generates the output file report.hml, but also produces a .drake/ cache in your working directory, which enables report.Rmd to compile on its own with with RStudio, knitr, or rmarkdown. A great way way to generate report.hml is still make(plan). That way, compilation happens if and only if there were changes to report.Rmd, report.hml, fit, or hist since the last make().



Try the drake package in your browser

Any scripts or data that you put into this service are public.

drake documentation built on Nov. 6, 2023, 5:09 p.m.