`tar_render()` from a static branch

Cross post from GitHub discussions.

Is there any good way to render from a static branch? I'd like to read in target into an Rmd file. Here's a small example pipeline.

library(targets)
library(tarchetypes)

targets <- tar_map(
  values = data.frame(sp = levels(iris$Species)),
  tar_target(data, dplyr::filter(iris, Species == sp)),
  tar_render(report, "report.Rmd")
)

And the corresponding Rmd

lines <- c(
  "---",
  "title: report.Rmd source file",
  "output_format: html_document",
  "---",
  "Assume these lines are in report.Rmd.",
  "```{r}",
  "targets::tar_read(data)",
  "```"
)

I'd like to be able to have the Rmd as is, but the actual target be data_setosa, etc.

See answer from the package author here.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.