Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommend a particular folder structure, rather than putting everything in the project root #29

Open
fkohrt opened this issue Dec 11, 2024 · 0 comments

Comments

@fkohrt
Copy link
Contributor

fkohrt commented Dec 11, 2024

This way, we can also demonstrate how to deal with relative vs. absolute paths and recommend a project-based workflow.

Of course, this is complicated by the fact that notebooks generally assume the working directory to be in their storage location, rather than the root folder of the project.

Either do the following:

```{r}
#| cache: false
#| include: false

knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
```

Or set execute-dir within _quarto.yml:

project:
  execute-dir: project

With rmarkdown, one would do the following:

rmarkdown::render(..., knit_root_dir = rprojroot::find_rstudio_root_file())

Note: package rprojroot is prefered for non-interactive use over here.

In RStudio, one can also set Tools > Global Options > R Markdown > Evaluate chunks in directory: Project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant