Suppress evaluation of knitr chunk options in custom language engine

At the very beginning of this discussion, I was resistant to actually calling tar_target() in a code chunk. I thought it seemed contrary to the script-focused mentality people were accustomed to.

```{tar_target analysis}
tar_target(
  name = analysis,
  command = run_analysis(data),
  pattern = map(data),
  error = "continue"
)
```

However, after having extensively explored chunk options with you, this is actually far more appealing. Not only does the interface perfectly align with targets, this approach allows us to do far more in interactive mode. The chunk engine could act exactly like tar_make() with just the targets in the chunk: construct a pipeline with just those targets, run the pipeline, and assign the return values to the user's environment, with all storage redirected to a temporary directory. Targets would stay up to date for that session. I am thinking a new tar_make_interactive() function could handle this.

Related: this approach could easily support interactive dynamic branching and interactive static branching, both of which would be impossible with the chunk option interface.

1 Like