A Simpler Way to Find Your Files

Constructs paths to your project's files. The 'here()' function uses a reasonable heuristics to find your project's files, based on the current working directory at the time when the package is loaded. Use it as a drop-in replacement for 'file.path()', it will always locate the files relative to your project root.


A simple interface to rprojroot.

Motivation

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"

Installation

here isn't on CRAN yet, install from GitHub via

devtools::install_github("krlmlr/here")

News

here 0.1 (2017-01-25)

Initial CRAN release.

  • Main function here()
    • Uses a fixed root that contains a .here file or can be either an RStudio project, an R package, a remake project, a Projectile project, or a VCS repository.
    • The root is established at package loading time, and shown with a message.
    • The current working directory is used as a fallback.
  • The set_here() function creates a .here file so that a directory is recognized as root by here().
  • The dr_here() function explains the reasoning of here() for the current session.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.