Replies: 1 comment 1 reply
-
I think you will have more luck with file.create("report.Rmd") # Does not require tar_read() or tar_load() if the data gets sent through Rmd parameters.
#> [1] TRUE
library(targets)
tar_script({
library(rlang)
library(tarchetypes)
tar_eval(
list(
tar_target(data, filter(mtcars, cyl == x)),
tar_render(report, "report.Rmd", params = list(data = data))
),
values = list(
x = c(4, 6),
data = syms(c("data_4", "data_6")),
report = syms(c("report_4", "report_6"))
)
)
})
tar_manifest(fields = command)
#> # A tibble: 4 × 2
#> name command
#> <chr> <chr>
#> 1 data_4 "filter(mtcars, cyl == 4)"
#> 2 data_6 "filter(mtcars, cyl == 6)"
#> 3 report_4 "tarchetypes::tar_render_run(path = \"report.Rmd\", args = list(para…
#> 4 report_6 "tarchetypes::tar_render_run(path = \"report.Rmd\", args = list(para…
tar_visnetwork() Created on 2022-03-24 by the reprex package (v2.0.1) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm not sure if this is outside of the realm of targets and archetypes, but I was wondering if there's a better way to use parameterized reports that rely on non-value targets? What I mean by that is that I have different data subsets and model fits that follow a naming pattern, and I want to use one set in each report. What I've come up with is a bit of a hack and has the issue that it doesn't track the dependencies so I need to manually make and invalidate targets. I could explicitly specify all the targets using
tar_load()
, but my hesitancy there is that there would be a lot of unnecessary targets loaded in each branch, and I think I'd still need to do something like below in order to select the correct targets to use in the report.Beta Was this translation helpful? Give feedback.
All reactions