Skip to content

[help] how to dynamically create a parameterized report file name with tar_render() #1393

Answered by wlandau
brndngrhm asked this question in Help
Discussion options

You must be logged in to vote

tar_render() is itself a target, so nesting it inside tar_target() is probably not what you're going for. In your case, I would do something like:

library(targets)
list(
  tar_target(
    name = analysis_data,
    make_analysis_data(data)
  ),
  tar_target(
    customer_type,
    c("US", "Intl"),
  ),
  tar_target(
    name = UMAP,
    train_umap(analysis_data, customer_type= customer_type),
    pattern = map(customer_type),
    deployment = "worker"
  ),
  tar_target(
    name = report_file,
    command = "R/reports/assess-UMAP.qmd",
    format = "file"
  ),
  tar_target(
    name = assess_UMAP,
    command = {
      rmarkdown::render(report_file, ...)
      WRITE_OUTPUT_FILE_HERE
    },…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brndngrhm
Comment options

Answer selected by brndngrhm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants