rprojroot

Finding files in project subdirectories

https://github.com/r-lib/rprojroot

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 15 committers (6.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary

Keywords from Contributors

tidy-data visualisation documentation-tool interface travis-ci data-manipulation report standardization latex rmarkdown
Last synced: 9 months ago · JSON representation

Repository

Finding files in project subdirectories

Basic Info
Statistics
  • Stars: 150
  • Watchers: 6
  • Forks: 24
  • Open Issues: 4
  • Releases: 11
Created about 11 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output:
  github_document:
    html_preview: false
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

set.seed(20230702)

clean_output <- function(x, options) {
  # Side effect
  usethis::use_build_ignore("index.md")

  x <- gsub("0x[0-9a-f]+", "0xdeadbeef", x)
  x <- gsub("dataframe_[0-9]*_[0-9]*", "      dataframe_42_42      ", x)
  x <- gsub("[0-9]*\\.___row_number ASC", "42.___row_number ASC", x)

  index <- x
  index <- gsub("─", "-", index)
  index <- strsplit(paste(index, collapse = "\n"), "\n---\n")[[1]][[2]]
  writeLines(index, "index.md")

  x <- gsub('(`vignette[(]"([^"]+)"[)]`)', "[\\1](https://rprojroot.r-lib.org/articles/\\2.html)", x)
  x <- fansi::strip_sgr(x)
  x
}

options(
  cli.num_colors = 256,
  cli.width = 71,
  width = 71,
  pillar.bold = TRUE,
  pillar.max_title_chars = 5,
  pillar.min_title_chars = 5,
  pillar.max_footer_lines = 12,
  conflicts.policy = list(warn = FALSE)
)

local({
  hook_source <- knitr::knit_hooks$get("document")
  knitr::knit_hooks$set(document = clean_output)
})

rlang::local_interactive(FALSE)
```

# [rprojroot](https://rprojroot.r-lib.org/)


[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![rcc](https://github.com/r-lib/rprojroot/workflows/rcc/badge.svg)](https://github.com/r-lib/rprojroot/actions)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/rprojroot)](https://cran.r-project.org/package=rprojroot)
[![Codecov test coverage](https://codecov.io/gh/r-lib/rprojroot/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/rprojroot?branch=main)


This package helps accessing files relative to a *project root* to [stop the working directory insanity](https://gist.github.com/jennybc/362f52446fe1ebc4c49f).
It is a low-level helper package for the [here](https://here.r-lib.org/) package.

```{r}
library(rprojroot)
```


## Example

The rprojroot package works best when you have a "project": all related files contained in a subdirectory that can be categorized using a strict criterion.
Let's create a package for demonstration.

```{r}
dir <- tempfile()
pkg <- usethis::create_package(dir)
```

R packages satisfy the `is_r_package` criterion.
A criterion is an object that contains a `find_file()` function.
With `pkg` as working directory, the function works like `file.path()`, rooted at the working directory:

```{r}
setwd(pkg)
is_r_package
is_r_package$find_file()
is_r_package$find_file("tests", "testthat")
```

This works identically when starting from a subdirectory:

```{r}
setwd(file.path(pkg, "R"))
is_r_package$find_file()
is_r_package$find_file("tests", "testthat")
```

There is one exception: if the first component passed to `find_file()` is already an absolute path.
This allows safely applying this function to paths that may be absolute or relative:

```{r}
setwd(file.path(pkg, "R"))
path <- is_r_package$find_file()
is_r_package$find_file(path, "tests", "testthat")
```


As long as you are sure that your working directory is somewhere inside your project, you can retrieve the project root.


## Installation and further reading

Install the package from CRAN:

``` r
install.package("rprojroot")
```

See the [documentation](https://rprojroot.r-lib.org/articles/rprojroot.html) for more detail.

---

## Code of Conduct

Please note that the rprojroot project is released with a [Contributor Code of Conduct](https://rprojroot.r-lib.org/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.

Owner

  • Name: R infrastructure
  • Login: r-lib
  • Kind: organization

GitHub Events

Total
  • Issues event: 9
  • Watch event: 2
  • Delete event: 41
  • Issue comment event: 14
  • Push event: 127
  • Pull request review event: 1
  • Pull request review comment event: 2
  • Pull request event: 96
  • Fork event: 1
  • Create event: 45
Last Year
  • Issues event: 9
  • Watch event: 2
  • Delete event: 41
  • Issue comment event: 14
  • Push event: 127
  • Pull request review event: 1
  • Pull request review comment event: 2
  • Pull request event: 96
  • Fork event: 1
  • Create event: 45

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 745
  • Total Committers: 15
  • Avg Commits per committer: 49.667
  • Development Distribution Score (DDS): 0.34
Past Year
  • Commits: 49
  • Committers: 4
  • Avg Commits per committer: 12.25
  • Development Distribution Score (DDS): 0.102
Top Committers
Name Email Commits
Kirill Müller k****r@m****g 492
Kirill Müller k****r@i****h 216
Indrajeet Patil p****e@g****m 8
Salim B g****t@s****e 7
BarkleyBG B****G 4
Mara Averick m****k@g****m 3
github-actions[bot] 4****] 3
karldw k****w 3
olivroy o****1@h****m 3
Garrick Aden-Buie g****k@a****m 1
Mitchell O'Hara-Wild m****d 1
Rekyt m****e@e****r 1
Sebastian Meyer s****r@f****e 1
Shinya Uryu u****a@n****p 1
aviator-app[bot] a****] 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 50
  • Total pull requests: 117
  • Average time to close issues: 8 months
  • Average time to close pull requests: 2 months
  • Total issue authors: 22
  • Total pull request authors: 16
  • Average comments per issue: 2.5
  • Average comments per pull request: 1.06
  • Merged pull requests: 85
  • Bot issues: 0
  • Bot pull requests: 19
Past Year
  • Issues: 5
  • Pull requests: 56
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 2 days
  • Issue authors: 3
  • Pull request authors: 4
  • Average comments per issue: 1.2
  • Average comments per pull request: 0.04
  • Merged pull requests: 32
  • Bot issues: 0
  • Bot pull requests: 19
Top Authors
Issue Authors
  • krlmlr (15)
  • jennybc (11)
  • BarkleyBG (3)
  • florisvdh (2)
  • olivroy (2)
  • hadley (2)
  • hute37 (1)
  • thomasp85 (1)
  • ctbrown (1)
  • hansvancalster (1)
  • yonicd (1)
  • llrs (1)
  • ndphillips (1)
  • salim-b (1)
  • moodymudskipper (1)
Pull Request Authors
  • krlmlr (93)
  • github-actions[bot] (36)
  • salim-b (8)
  • olivroy (3)
  • mitchelloharawild (2)
  • bastistician (2)
  • jthurner (2)
  • batpigandme (2)
  • BarkleyBG (2)
  • gadenbuie (1)
  • Rekyt (1)
  • bcipolli (1)
  • karldw (1)
  • llrs (1)
  • uribo (1)
Top Labels
Issue Labels
help wanted (3) bug (1)
Pull Request Labels
mergequeue (6) blocked (2) CRAN release :station: (1)

Packages

  • Total packages: 2
  • Total downloads:
    • cran 538,518 last-month
  • Total docker downloads: 203,672,274
  • Total dependent packages: 82
    (may contain duplicates)
  • Total dependent repositories: 371
    (may contain duplicates)
  • Total versions: 16
  • Total maintainers: 1
cran.r-project.org: rprojroot

Finding Files in Project Subdirectories

  • Versions: 12
  • Dependent Packages: 82
  • Dependent Repositories: 371
  • Downloads: 538,518 Last month
  • Docker Downloads: 203,672,274
Rankings
Downloads: 0.4%
Dependent repos count: 0.8%
Dependent packages count: 1.1%
Stargazers count: 2.8%
Forks count: 3.2%
Average: 4.3%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 10 months ago
proxy.golang.org: github.com/r-lib/rprojroot
  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.0.0 depends
  • covr * suggests
  • knitr * suggests
  • lifecycle * suggests
  • mockr * suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
  • withr * suggests
tests/testthat/hierarchy/DESCRIPTION cran
  • R >= 3.2.0 depends
.github/workflows/R-CMD-check-dev.yaml actions
  • ./.github/workflows/check * composite
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/dep-matrix * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/rate-limit * composite
  • ./.github/workflows/update-snapshots * composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/R-CMD-check.yaml actions
  • ./.github/workflows/check * composite
  • ./.github/workflows/commit * composite
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/pkgdown-build * composite
  • ./.github/workflows/pkgdown-deploy * composite
  • ./.github/workflows/rate-limit * composite
  • ./.github/workflows/roxygenize * composite
  • ./.github/workflows/style * composite
  • ./.github/workflows/update-snapshots * composite
  • actions/checkout v3 composite
.github/workflows/check/action.yml actions
  • actions/upload-artifact main composite
  • r-lib/actions/check-r-package v2 composite
.github/workflows/fledge.yaml actions
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • actions/checkout v2 composite
.github/workflows/install/action.yml actions
  • ./.github/workflows/get-extra * composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lock.yaml actions
  • dessant/lock-threads v2 composite
.github/workflows/pkgdown-deploy/action.yml actions
  • nick-fields/retry v2 composite
.github/workflows/pkgdown.yaml actions
  • ./.github/workflows/custom/after-install * composite
  • ./.github/workflows/custom/before-install * composite
  • ./.github/workflows/git-identity * composite
  • ./.github/workflows/install * composite
  • ./.github/workflows/pkgdown-build * composite
  • ./.github/workflows/pkgdown-deploy * composite
  • ./.github/workflows/rate-limit * composite
  • actions/checkout v3 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch master composite
  • r-lib/actions/pr-push master composite
  • r-lib/actions/setup-r master composite
.github/workflows/revdep.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v2 composite
.github/workflows/style/action.yml actions
  • actions/cache v3 composite
.github/workflows/update-snapshots/action.yml actions
  • peter-evans/create-pull-request v4 composite
.github/workflows/commit/action.yml actions
.github/workflows/dep-matrix/action.yml actions
.github/workflows/dep-matrix-suggests/action.yml actions
.github/workflows/get-extra/action.yml actions
.github/workflows/git-identity/action.yml actions
.github/workflows/pkgdown-build/action.yml actions
.github/workflows/rate-limit/action.yml actions
.github/workflows/roxygenize/action.yml actions
tests/testthat/package/DESCRIPTION cran