Output directory in quarto-cli #2171
Replies: 7 comments 23 replies
-
Define a project:
output-dir: results/reports/ There is also the directory in which the execution happens, by default this is where the Quarto document lives, see https://quarto.org/docs/projects/code-execution.html#working-dir. Also you could use the |
Beta Was this translation helpful? Give feedback.
-
I strongly support this request. I have a solid data-analysis workflow based on Resorting to some ad-hoc code for copying over the resulting files is cumbersome, error prone and breaks the workflow and the chain of dependencies in the pipeline. Best, |
Beta Was this translation helpful? Give feedback.
-
I second this! Best things is that quarto(-cli) can greatly simplify the rendering, as well as give tremendous control in a single line – which knit couldn't provide IMO. An option such as |
Beta Was this translation helpful? Give feedback.
-
I second this! In my case the process rendering qmd files do not have write access to the script folder (only read). So it is not able to render the qmd files in the script folder. The current workaround is to:
Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
A more flexible option to specify the output directory would be really useful. I render a lot of ad-hoc reports that are stored in different parts of my code base, and I want the output to be stored in various sub-folders that I use to organize my results. Right now I use some minor shell scripting to put the results where I want them, but this would be greatly simplified if there were a working option to set the output directory.
|
Beta Was this translation helpful? Give feedback.
-
On a related note, I'm having a similar issue using For example, this will work: quarto::quarto_render(
input = "document.qmd",
output_file = "template.pdf"
) But this will produce an error: quarto::quarto_render(
input = "document.qmd",
output_file = file.path("pdf", "template.pdf")
)
This is really unfortunate because one of the only reasons I might use Edit: A work around is to simply render these and then add another line to move the files into a folder, which is easy enough, but I still would expect that I should be able to render them into a sub folder. |
Beta Was this translation helpful? Give feedback.
-
For anyone wondering about this issue, here is an update as of Quarto CLI v1.5.23 (pre-release), about using Quarto CLI v1.5.23
mkdir demo
echo "---\ntitle: "Untitled"\nformat: html\nembed-resources: true\n---" > demo/demo.qmd
quarto render demo/demo.qmd --output-dir output
tree
#> .
#> └── demo
#> ├── demo.qmd
#> └── output
#> └── demo.html
#>
#> 3 directories, 2 files But, for many reasons you can end up with a touch _quarto.yml
mkdir demo
echo "---\ntitle: "Untitled"\nformat: html\nembed-resources: true\n---" > demo/demo.qmd
quarto render demo/demo.qmd --output-dir output
tree
#> .
#> ├── _quarto.yml
#> ├── demo
#> │ └── demo.qmd
#> └── output
#> └── demo
#> └── demo.html
#>
#> 4 directories, 3 files Note that trying to render from a sub-directory of a Quarto project will still "fail" as it will have the same result as the example above (kind of expected since Quarto resolves the root using touch _quarto.yml
mkdir demo
echo "---\ntitle: "Untitled"\nformat: html\nembed-resources: true\n---" > demo/demo.qmd
cd demo
quarto render demo.qmd --output-dir output
tree ../
#> ../
#> ├── _quarto.yml
#> ├── demo
#> │ └── demo.qmd
#> └── output
#> └── demo
#> └── demo.html
#>
#> 4 directories, 3 files |
Beta Was this translation helpful? Give feedback.
-
(this discussion started in the Rstudio community but I got asked to move it here)
I am trying
quarto
as a replacement for my Rmd-basedrmarkdown::render
workflow to render reports into specific folders and encountered what I think is a missing feature inquarto
. The usual project structure has the Rmd files in a scripts folder and then I render them to specific results folders :project_base:
I do this with:
this is particularly useful when rendering separate parametrized reports for either different datasets or arguments:
Thus generating the files:
Very flexible and part of my daily set-up.
Trying to recreate this in quarto-cli with a simple example, I thought thought the way to go was the option --output-dir:
However this places all outputs in the same directory as the qmd file (scripts/) and not in the output-dir:
A few things I tried but did not mimic the expected behaviour:
quarto create
and then rendered the script withquarto render scripts/hello.qmd --output-dir results
. It sort of works, but the output is sent to "results/scripts/"post-render: xcopy *_files output
is not a solution beacuse it would have to be reweiteen for every loop iteration in the example above.Christophe Dervieux mentioned that this is not planned feature and so I would like to get the discussion started.
Cheers-
Beta Was this translation helpful? Give feedback.
All reactions