mm218.dev
mm218.dev copied to clipboard
posts/2022-08-04-how-to-use-quarto-for-parameterized-reporting/
Mike Mahoney - How to use Quarto for Parameterized Reporting
You know. If you wanna.
https://www.mm218.dev/posts/2022-08-04-how-to-use-quarto-for-parameterized-reporting/
Any advise for using parameters with Python code used in a Quarto report? Is this possible?
Hey @marierivers ! Yes! I'm going to steal from the official Quarto docs here, because I don't use the Juypter engines that often: https://quarto.org/docs/computations/parameters.html#jupyter
From the docs: For Jupyter, Quarto uses the same syntax for defining parameters as Papermill. To parameterize a notebook, designate a cell with the tag parameters and provide appropriate default values:
#| tags: [parameters]
alpha = 0.1
ratio = 0.1
The parameters are available in the top level environment:
str(alpha)
Excellent guide, very helpful. I'd like to produce multiple HTML files but how can I name them using parameters?
I'm not immediately sure, @pelld ! If you ask over at https://github.com/quarto-dev/quarto-cli/discussions they might be able to help.
@pelld You might use quarto_render
command as shown in this stackoverflow discussion:
https://stackoverflow.com/questions/73588271/customizing-r-quarto-pdf-output-file-name
The same post also shows more output file naming options.
This was far more entertaining than it had any right to be! Parameterized SQL looks very interesting, thanks for sharing this.
Thank you Mike. I enjoyed reading this. My problem, which ultimately led me here is to render customized reports for a number of say health facilities without doing a single report for each. Any advice on how I would actually execute that? I am thinking params is the way to go, but may you could shed more light on how I would execute that?
Thank you so much, This was incredibly helpful and much appreciated.