mm218.dev icon indicating copy to clipboard operation
mm218.dev copied to clipboard

posts/2022-08-04-how-to-use-quarto-for-parameterized-reporting/

Open utterances-bot opened this issue 2 years ago • 8 comments

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/

utterances-bot avatar Oct 08 '22 03:10 utterances-bot

Any advise for using parameters with Python code used in a Quarto report? Is this possible?

marierivers avatar Oct 08 '22 03:10 marierivers

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)

mikemahoney218 avatar Oct 08 '22 14:10 mikemahoney218

Excellent guide, very helpful. I'd like to produce multiple HTML files but how can I name them using parameters?

pelld avatar Feb 10 '23 14:02 pelld

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.

mikemahoney218 avatar Feb 10 '23 15:02 mikemahoney218

@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.

ssinari avatar Feb 22 '23 02:02 ssinari

This was far more entertaining than it had any right to be! Parameterized SQL looks very interesting, thanks for sharing this.

MokeEire avatar Feb 24 '23 21:02 MokeEire

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?

KilemiD avatar Jun 15 '23 20:06 KilemiD

Thank you so much, This was incredibly helpful and much appreciated.

akins11 avatar May 14 '24 10:05 akins11