I have the following common use case:

- writing a report with many qmd chapters
- each chapter calculates key facts (in R)
- up-front summary chapter reprises key facts in text with inline code and perhaps includes a summary table

Thus, I need to calculate the facts in the body-of-the-report chapters before executing the code for the summary chapter, but I want the summary to appear first. It would be great to define an execution order for the files and an appearance order for the files that may be different, so that I could calculate the summary chapter last but have it appear first.

There are workarounds, of course, such as:

- Calculate everything first - for example, R files executed at the start that do all calculations, and the qmd files merely report the results (tables, figures, inline text). But this makes for a potentially awkward and error-prone workflow as it requires thinking about the whole project and its presentation separately. A more-natural workflow (for me) is to develop the calculations at the same time and in the same place that I am figuring out how to present the information.
- Have every full execution create and save results into a prior-results folder. In the _next_ execution these results will be available to the summary chapter at the start. Requires being extra-careful that the results have not changed from one execution to the next, or putting in error checking to be sure that, after all files are executed, the current results are the same as prior results.

Neither of these seems as good as having the ability to separate execution order from appearance order.

Would love to hear if there are better workarounds - or perhaps quarto already has this capability and I haven't found it yet.

Many thanks.




2022-12-05T11:36:48Z
donboyd5
Future
open
Feature request: For quarto book qmd files, allow execution order to differ from order appearing in book
https://github.com/quarto-dev/quarto-cli/issues/3568