standardize_wd
Standardize Working Directory for Framework Projects
This function helps standardize the working directory when working with framework projects, especially useful in Quarto/RMarkdown documents that may be rendered from subdirectories.
Usage
standardize_wd(project_root = NULL)
Arguments
| Argument | Description |
|---|---|
project_root
|
Character string specifying the project root directory. If NULL (default), the function will attempt to find it automatically. |
Details
The function looks for common framework project indicators:
- settings.yml or settings.yml file
- .Rprofile file
- Being in common subdirectories (scratch, work)
It sets both the regular working directory and knitr's root.dir option if knitr is available.
Returns
Invisibly returns the standardized project root path.
Examples
library(framework)
standardize_wd()
scaffold()
Source: R/framework_util.R