In any larger project that needs subdirectories, it is important to have a consistent way to locate files. Paths relative to the project root make sense, but in R, the current working directory cannot be always assumed to be the project root (think vignettes and tests).

Introducing rprojroot:

# Find the root of an R package, identified by a DESCRIPTION file
rprojroot::find_root("DESCRIPTION")

## [1] "/path/to/your/package/root"

This works no matter what your current working directory is, as long as it is somewhere below the project root. Promised.

Interested? There's more to it, check out the vignette or the online package documentation.

Largely inspired by the post Stop the working directory insanity by Jennifer Bryan, and of course by Git.

From zero to tested in five minutes

Set up testing of R packages with GitHub and wercker Continue reading

Using .gitattributes to avoid merge conflicts

Published on February 25, 2014

xpreen — Integrating xpra with GNU Screen

Published on August 07, 2013