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
| Name | Description |
|---|---|
| project_root |
Character string specifying the project root directory. If NULL (default), the function will attempt to find it automatically. |
Value
Invisibly returns the standardized project root path.
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.
Examples
if (FALSE) {
library(framework)
standardize_wd()
scaffold()
}