Executing a Quarto project (located in a subdirectory) from the root of an R project #10535
-
DescriptionI'm using a research compendium for a project. The compendium has the basic structure of an R package plus some extra directories for the analyses and manuscript. I'm using a A simplified structure of the project looks like this: .
├── .Rprofile
├── DESCRIPTION
├── NAMESPACE
├── R
│ └── utils.R
├── data
│ └── data.parquet
├── man
├── manuscript
│ ├── references.bib
│ └── index.qmd
├── foo.Rproj
└── scripts
├── analyses.R
└── results.R Everything is interconnected. E.g. I render quarto::quarto_render(
input = "manuscript/index.qmd",
execute_dir = "."
) This works because I'm now trying to replace this standalone My question is: is there a way to make a Quarto project work with that workflow? The similar discussions I've found seem to imply there's no ways to make it work but since my workflow is quite different I prefer asking for confirmation. Edit |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
You can change the execute directory via Quarto CLI: https://quarto.org/docs/projects/code-execution.html#working-dir For related R package development, the repository is https://github.com/quarto-dev/quarto-r Note that the R package is a limited wrapper to Quarto CLI. |
Beta Was this translation helpful? Give feedback.
I'll try to clarify a few things
execute_dir = "."
in the R function is equivalent to callingquarto render <file> --execute-dir .
. Quarto will normalize the path.
from where thequarto render
command is called. So in here,it will be from root of you RStudio project. If you call that from another folder it would be different. Using
.
is not the safest to insure correct path is used.For knitr engine,
--execute-dir
will set the value forknit_root_dir
argument inrmarkdown::ren…