Skip to content

Working interactively on Quarto document inside an R project with relative paths #6449

@Art-Ink

Description

@Art-Ink

System details:

Positron and OS details:

Positron Version: 2025.01.0 (user setup) build 159
Code - OSS Version: 1.95.0
Commit: bc8820b
Date: 2025-01-09T23:52:00.440Z
Electron: 32.2.1
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

Interpreter details:

R 4.4.2

Describe the issue:

I keep Quarto documents in a documents folder inside my R project folder and source certain functions from R files in a spearate R folder on the same level. I also maintain the project with renv.

When I use relative paths for the source command (../R/some_function.r) I can render the document via the cli without issues from the project directory. Hoewever, when I interactively work with the Quarto document all chunks are evaluated using the project directory as WD, not the project/documents directory. causing the source path fail to resolve.

Adjusting the working directory fixes the issue but causes the R session to not detect the project associated renv leading to a different mode of failure.

This is not the case in RStudio where I also work on the project level directory but the Quarto file automatically uses its own position to resolve relative paths when executed interactively.

Expected or desired behavior:

A Quarto document executed interactively inside a subdirectory of a R project should resolve relative paths relative to its own location, not the project WD as it is done in RStudio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: quartoIssues related to Quarto category.enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions