Open andyofsmeg opened 2 years ago
bookdown defaults to a Merge and Knit approach where all the document are merged before knitting. Other approach Knit and Merge when new_session: true
renders each file its own session. More on that in https://bookdown.org/yihui/bookdown/new-session.html
Quarto works in a way similar to the latter where document each run R code in a separate session. See discussion about this in other discussion like https://github.com/quarto-dev/quarto-cli/discussions/1045 and linked ones.
For now, you would need to use some explicit caching and object saving + reloading if you want to share data across R sessions in several files.
Regarding parameters, it is supported in Quarto and should be working in Book format also (https://quarto.org/docs/computations/parameters.html). But what you mean is that the parameter is not accessible in other document right ?
It is possible that we need to add support for parameters defined in _quarto.yml
which is not possibly yet I think.
issue #1712 would solve if the needed shared environments were in adjacent chapters, so like chapter 8 and chapter 9. You could put the chapters in one qmd file.
Thanks. An environment option when rendering would be useful. Regarding parameters in a book, yes. I mean the same as with environment variables. I can define within one chapter but they are not passed on. I would like to be able to define parameters centrally and have all chapters be able to access them.
I would like to be able to define parameters centrally and have all chapters be able to access them.
Is this currently possible? Can I pass --execute-params params.yaml
with a central params.yaml
shared across all chapters?
Having this available from _quarto.yml
would be very useful, or some kind of meta file; not sure how far away that feature is yet but would be excited to hear about progress on this.
For reference the params topic is related to
Hi, has there been any development on having parameters passed from the _quarto.yml file? Alternatively, can anyone suggest a workaround for my situation? I'm trying to make a book with a dynamic title and footer based on runtime-defined parameters (i.e., using execute_params command when rendering), but it doesn't render with the parameters passed through that command. It will only render with the "blank" parameters that I pre-define at the beginning of the index.qmd file (that I assume would've been replaced by the runtime parameter values).
@jonpeake The issue is still open and the milestone is set to Future meaning, it is planned but not in a short term timeframe.
Since this is an issue and are asking for something in particular, I suggest you open a discussion and share a concrete small example of your setup, alongside a clear explanation of what your goal is and what you want to achieve.
Thank you for the update, I appreciate it. I'll go ahead and set up a discussion post in the meantime.
I'm playing with Quarto Books for the first time having been a R/bookdown user for a while. I have a simple book with two chapters. In the first chapter I define a variable ,
x
, and I want to then usex
in my second chapter. In bookdown this works fine. But with Quarto I get, "Error in eval(expr, envir, enclos) : object 'x' not found" when I click render in RStudio. I'm very willing to accept user error, or that independence of chapters is a design choice. But it wasn't something I was expecting.I've attached a worked example.
What I'm actually more interesting in working out is how to pass params (from a YAML header) from chapter to chapter. Previously I could include something like this in the index file:
and then access it in all other chapters test_params_quorto.zip .