Constructs paths to your project's files. Declare the relative path of a file within your project with 'i_am()'. Use the 'here()' function as a drop-in replacement for 'file.path()', it will always locate the files relative to your project root.
A simple interface to rprojroot
.
The logic to find a project root based on certain criteria is packaged in the rprojroot
package. Many projects might not need the full power, and the complexity that comes with it. Meet here
:
library(here)here()#> [1] "/home/muelleki/git/R/here"here("DESCRIPTION")#> [1] "/home/muelleki/git/R/here/DESCRIPTION"here("R", "here.R")#> [1] "/home/muelleki/git/R/here/R/here.R"
here
isn't on CRAN yet, install from GitHub via
devtools::install_github("krlmlr/here")
Initial CRAN release.
here()
.here
file or can be either an RStudio project, an R package, a remake
project, a Projectile project, or a VCS repository.set_here()
function creates a .here
file so that a directory is recognized as root by here()
.dr_here()
function explains the reasoning of here()
for the current session.