| Title: | File Paths Relative to Project Roots |
|---|---|
| Description: | Provides a set of helper functions for constructing file paths relative to the root of various types of projects, such as R packages, Git repositories, and more. File paths are specified with function arguments, or `$` to navigate into folders to specific files supported by auto-completion. |
| Authors: | Mitchell O'Hara-Wild [aut, cre] (ORCID: <https://orcid.org/0000-0001-6729-7695>) |
| Maintainer: | Mitchell O'Hara-Wild <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-16 05:21:30 UTC |
| Source: | https://github.com/mitchelloharawild/fromhere |
These functions generate file paths relative to the root of a specific type of project.
They use criteria from rprojroot to locate the root directory and construct paths
using file.path().
from_here(...) from_wd(...) from_rproj(...) from_r_package(...) from_remake(...) from_drake(...) from_targets(...) from_pkgdown(...) from_renv(...) from_projectile(...) from_quarto(...) from_git(...) from_svn(...) from_vcs(...) from_testthat(...)from_here(...) from_wd(...) from_rproj(...) from_r_package(...) from_remake(...) from_drake(...) from_targets(...) from_pkgdown(...) from_renv(...) from_projectile(...) from_quarto(...) from_git(...) from_svn(...) from_vcs(...) from_testthat(...)
... |
Character components of the relative file path. |
Functions support two ways to specify paths: as function arguments
(e.g., from_r_package("path/to/file")) or using the $ operator
(e.g., from_r_package$path$to$file), which supports autocompletion.
The following from_* functions are available:
from_here: For paths relative to the {here} package's automatic project root.
from_rproj: For R project directories.
from_r_package: For R package directories.
from_remake: For remake project directories.
from_drake: For drake project directories.
from_targets: For targets project directories.
from_pkgdown: For pkgdown project directories.
from_renv: For renv project directories.
from_projectile: For Projectile project directories.
from_quarto: For Quarto project directories.
from_git: For Git repository root directories.
from_svn: For SVN repository root directories.
from_vcs: For generic version control root directories (Git or SVN).
from_testthat: For testthat directories.
A file path which allows further traversal with $ autocompletion.
# Construct a path from the current working directory from_wd() ## Not run: # Construct a path to a file in an R package from_r_package("R", "my_file.R") # Construct a path in a pkgdown project from_pkgdown$docs$index.html # Construct a path in a Git repository from_git("src", "main.c") ## End(Not run)# Construct a path from the current working directory from_wd() ## Not run: # Construct a path to a file in an R package from_r_package("R", "my_file.R") # Construct a path in a pkgdown project from_pkgdown$docs$index.html # Construct a path in a Git repository from_git("src", "main.c") ## End(Not run)