Quarto Book: reference chunk data in another file #431
Replies: 6 comments 14 replies
-
My advice here would be to create a pre-render script (https://quarto.org/docs/projects/quarto-projects.html#pre-and-post-render-scripts) that creates an |
Beta Was this translation helpful? Give feedback.
-
Would it work for your scenario to put your common initialization code in Another approach would be to |
Beta Was this translation helpful? Give feedback.
-
So I think what you really need is back to using a single render for the entire book, then split the chapters (as bookdown does). We don't currently support this model unfortunately (it's a non-trivial amount of work so not something we can knock out quickly) |
Beta Was this translation helpful? Give feedback.
-
My playground, assume index.rmd (same with qmd)
I other files, refer to these as:
Uncached chunks are sourced, cached are read from cache. No need to rewrite the code to process all file, nice separation as in quarto works fine. |
Beta Was this translation helpful? Give feedback.
-
As jjallaire mentioned, there is a https://quarto.org/docs/reference/projects/options.html But, too bad, it is not useful because of this: https://community.rstudio.com/t/quarto-book-start-equivalent/144196/2 |
Beta Was this translation helpful? Give feedback.
-
are there any updates on this? has anyone able to make a global render work? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is a repost of https://community.rstudio.com/t/quarto-book-reference-chunk-data-in-another-file/131967/2 as suggested by cderv
In bookdown , I had a choice between KM and MK rendering approaches. In MK mode, I had access to chapters further up in the book.
Assuming I have a "global" chunk in one chapter, how do make it available to other files? I have tried to reference chunks using dependson, but could not get it to work.
---- Here some additional information to explain my standard procedure to write large reports ---
bookdown
was not perfect in MK mode. When you had several chapters, everything was carried along, that's a mess. I typically only want to include only one chunk's content, typically in index.rmd, e.g. with global constants and database pool. My method worked well, but maybe was a bit clunky:'Index.rmd' had one chunk, with `this_is_the_first_file = TRUE' defined. I use MK strategy.
In bookdown.yml:
before_chapter_script.R:
after_chapter_script.R:
Jenny-don't-use-rm(list()), please forgive me. It worked.
Beta Was this translation helpful? Give feedback.
All reactions