-
Not sure if it's a bug or feature. I realise that if two targets are "mapped", they have to be in the same targets chunk for it to work in interactive mode. Example: This works in both interactive and non-interactive mode: ```{targets combined}
list(
tar_target(raw_data_combined, mtcars %>% group_by(cyl) %>% tar_group(), iteration = "group"),
tar_target(count_row_combined, nrow(mtcars), pattern = map(raw_data))
) This only works in non-interactive mode: ```{targets raw-data}
tar_target(raw_data, mtcars %>% group_by(cyl) %>% tar_group(),
iteration = "group") ```{targets count-row}
tar_target(count_row, nrow(mtcars), pattern = map(raw_data)) When I run it interactively in the Rmarkdown interface, the following error occur:
Anyone has experienced this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This is a limitation. Interactive mode deliberately runs only the part of the pipeline inside the chunk, independently of other chunks. This helps write the R Markdown modularly and break down the pipeline into small pieces that are quick to run in a testing/prototyping scenario. The tradeoff, as you have seen, is that a chunk might not include upstream targets that dynamic targets depend on for branching. I have thought about this, and I do not think there is a good solution from a development point of view. It would either require a |
Beta Was this translation helpful? Give feedback.
This is a limitation. Interactive mode deliberately runs only the part of the pipeline inside the chunk, independently of other chunks. This helps write the R Markdown modularly and break down the pipeline into small pieces that are quick to run in a testing/prototyping scenario. The tradeoff, as you have seen, is that a chunk might not include upstream targets that dynamic targets depend on for branching. I have thought about this, and I do not think there is a good solution from a development point of view. It would either require a
{targets}
code chunk to be aware of other{targets}
code chunks, or it would require allowing dynamic targets to map over non-targets, neither of which is f…