An open API service indexing awesome lists of open source software.

https://github.com/r-world-devs/gitstats

An R package to get statistics from GitHub and GitLab.
https://github.com/r-world-devs/gitstats

git github gitlab metadata r

Last synced: 11 months ago
JSON representation

An R package to get statistics from GitHub and GitLab.

Awesome Lists containing this project

README

          

---
output: github_document
---

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

# GitStats

[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/r-world-devs/GitStats/workflows/R-CMD-check/badge.svg)](https://github.com/r-world-devs/GitStats/actions)
[![Codecov test coverage](https://codecov.io/gh/r-world-devs/GitStats/branch/devel/graph/badge.svg)](https://app.codecov.io/gh/r-world-devs/GitStats?branch=devel)

With GitStats you can pull git data in a uniform way (table format) from GitHub and GitLab. For the time-being you can get data on:

* repositories,
* commits,
* users,
* release logs,
* text files content,
* R package usage.

## Installation

From CRAN:

```r
install.packages("GitStats")
```

From GitHub:

```r
devtools::install_github("r-world-devs/GitStats")
```

## Examples:

Setup your `GitStats`:

```{r}
library(GitStats)

git_stats <- create_gitstats() |>
set_gitlab_host(
repos = "mbtests/gitstatstesting"
) |>
set_github_host(
orgs = "r-world-devs",
repos = "openpharma/DataFakeR"
)
```

Get commits:

```{r}
commits <- git_stats |>
get_commits(
since = "2022-01-01"
)

commits

commits |>
get_commits_stats(
time_aggregation = "month",
group_var = author
)
```

Get repositories with specific code:

```{r}
git_stats |>
get_repos(
with_code = "shiny",
add_contributors = FALSE
)
```

Get files:

```{r}
git_stats |>
get_files(
pattern = "\\.md",
depth = 2L
)
```

Get package usage:

```{r}
git_stats |>
get_R_package_usage(
packages = c("shiny", "purrr"),
split_output = TRUE
)
```

Print `GitStats` to see what it stores:

```{r}
git_stats
```

## Acknowledgement

Special thanks to [James Black](https://github.com/epijim), [Karolina Marcinkowska](https://github.com/marcinkowskak), [Kamil Koziej](https://github.com/Cotau), [Matt Secrest](https://github.com/mattsecrest), [Krystian Igras](https://github.com/krystian8207), [Kamil Wais](https://github.com/kalimu), [Adam Forys](https://github.com/galachad) - for the support in the package development.