Skip to content
Finding files in project subdirectories
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
docs
inst/staticdocs
man
readme
revdep
tests
vignettes
.Rbuildignore
.gitattributes
.gitignore
.travis.yml
API
DESCRIPTION
Makefile
NAMESPACE
NEWS.md
README.md
_pkgdown.yml
appveyor.yml
cran-comments.md
rprojroot.Rproj
tic.R

README.md

rprojroot

Travis-CI Build Status AppVeyor Build Status codecov.io CRAN_Status_Badge

This package helps accessing files relative to a project root to stop the working directory insanity.

Example

The source for this text is in the readme subdirectory:

basename(getwd())
#> [1] "readme"

How do we access the package root? In a robust fashion? Easily:

dir(rprojroot::find_root("DESCRIPTION"))
#>  [1] "_pkgdown.yml"     "API"              "appveyor.yml"    
#>  [4] "cran-comments.md" "DESCRIPTION"      "docs"            
#>  [7] "inst"             "Makefile"         "man"             
#> [10] "NAMESPACE"        "NEWS.md"          "R"               
#> [13] "readme"           "README.md"        "revdep"          
#> [16] "rprojroot.Rproj"  "tests"            "tic.R"           
#> [19] "vignettes"

Installation and further reading

Install from GitHub:

devtools::install_github("r-lib/rprojroot")

See the documentation for more detail.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.