| Title: | Standardized Git Repository Data |
|---|---|
| Description: | Obtain standardized data from multiple 'Git' services, including 'GitHub' and 'GitLab'. Designed to be 'Git' service-agnostic, this package assists teams with activities spread across various 'Git' platforms by providing a unified way to access repository data. |
| Authors: | Maciej Banas [aut, cre], Kamil Koziej [aut], Karolina Marcinkowska [aut], Matt Secrest [aut] |
| Maintainer: | Maciej Banas <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.5.2 |
| Built: | 2026-05-07 08:34:31 UTC |
| Source: | https://github.com/r-world-devs/gitstats |
GitStats objectCreate a GitStats object
create_gitstats()create_gitstats()
A GitStats object.
my_gitstats <- create_gitstats()my_gitstats <- create_gitstats()
List all commits from all repositories for an organization or a vector of repositories.
get_commits( gitstats, since = NULL, until = Sys.Date(), cache = TRUE, verbose = FALSE, progress = TRUE )get_commits( gitstats, since = NULL, until = Sys.Date(), cache = TRUE, verbose = FALSE, progress = TRUE )
gitstats |
A |
since |
A starting date. |
until |
An end date. |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
A table of tibble and gitstats_commits classes.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("openpharma/DataFakeR", "openpharma/visR") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_commits(my_gitstats, since = "2018-01-01") ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("openpharma/DataFakeR", "openpharma/visR") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_commits(my_gitstats, since = "2018-01-01") ## End(Not run)
Prepare statistics from the pulled commits data.
get_commits_stats( commits, time_aggregation = c("year", "month", "week", "day"), group_var )get_commits_stats( commits, time_aggregation = c("year", "month", "week", "day"), group_var )
commits |
A |
time_aggregation |
A character, specifying time aggregation of statistics. |
group_var |
Other grouping variable to be passed to |
To make function work, you need first to get commits data with
GitStats. See examples section.
A table of commits_stats class.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("r-world-devs/GitStats", "openpharma/visR") ) |> get_commits(my_gitstats, since = "2022-01-01") |> get_commits_stats( time_aggregation = "year", group_var = author ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("r-world-devs/GitStats", "openpharma/visR") ) |> get_commits(my_gitstats, since = "2022-01-01") |> get_commits_stats( time_aggregation = "year", group_var = author ) ## End(Not run)
Pulls text files and their content.
get_files( gitstats, pattern = NULL, depth = Inf, file_path = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )get_files( gitstats, pattern = NULL, depth = Inf, file_path = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )
gitstats |
A |
pattern |
A regular expression. If defined, it pulls content of all
files in a repository matching this pattern reaching to the level of
directories defined by |
depth |
Defines level of directories to retrieve files from. E.g. if set
to |
file_path |
A specific path to file(s) in repositories. May be a
character vector if multiple files are to be pulled. If defined, the
function pulls content of this specific |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
get_files() may be used in two ways: either with pattern (with
optional depth) or file_path argument defined.
In the first scenario, GitStats will pull first a files structure
responding to the passed pattern and depth arguments and afterwards
files content for all of these files. In the second scenario, GitStats
will pull only the content of files for the specific file_path of the
repository.
If user wants to pull a particular file or files, a file_path approach
seems more reasonable, as it is a faster way since it omits pulling the
whole file structure from the repo.
For example, if user wants to pull content of README.md and/or NEWS.md
files placed in the root directories of the repositories, he should take
the file_path approach as he already knows precisely paths of the files.
On the other hand, if user wants to pull specific type of files (e.g. all
.md or .Rmd files in the repository), without knowing their path, it is
recommended to use a pattern approach, which will trigger GitStats to
find all the files in the repository on the given level of directories
(pattern argument) and afterwards pull their content.
The latter approach is slower than the former but may be more useful
depending on users' goals. Both approaches return data in the same format:
tibble with data on files, namely their path and their content.
A data.frame.
## Not run: git_stats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) rmd_files <- get_files( gitstats = git_stats, pattern = "\\.Rmd", depth = 2L ) app_files <- get_files( gitstats = git_stats, file_path = c("R/app.R", "R/ui.R", "R/server.R") ) ## End(Not run)## Not run: git_stats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) rmd_files <- get_files( gitstats = git_stats, pattern = "\\.Rmd", depth = 2L ) app_files <- get_files( gitstats = git_stats, file_path = c("R/app.R", "R/ui.R", "R/server.R") ) ## End(Not run)
List all issues from all repositories for an organization or a vector of repositories.
get_issues( gitstats, since = NULL, until = Sys.Date(), state = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )get_issues( gitstats, since = NULL, until = Sys.Date(), state = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )
gitstats |
A |
since |
A starting date. |
until |
An end date. |
state |
An optional character, by default |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
A table of tibble and gitstats_issues classes.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("openpharma/DataFakeR", "openpharma/visR") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_issues(my_gitstats, since = "2018-01-01", state = "open") ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("openpharma/DataFakeR", "openpharma/visR") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_issues(my_gitstats, since = "2018-01-01", state = "open") ## End(Not run)
Prepare statistics from the pulled issues data.
get_issues_stats( issues, time_aggregation = c("year", "month", "week", "day"), group_var )get_issues_stats( issues, time_aggregation = c("year", "month", "week", "day"), group_var )
issues |
A |
time_aggregation |
A character, specifying time aggregation of statistics. |
group_var |
Other grouping variable to be passed to |
To make function work, you need first to get issues data with
GitStats. See examples section.
A table of issues_stats class.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("r-world-devs/GitStats", "openpharma/visR") ) |> get_issues(my_gitstats, since = "2022-01-01") |> get_issues_stats( time_aggregation = "month", group_var = state ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("r-world-devs/GitStats", "openpharma/visR") ) |> get_issues(my_gitstats, since = "2022-01-01") |> get_issues_stats( time_aggregation = "month", group_var = state ) ## End(Not run)
Pulls data on all organizations from a Git host and parses it into table format.
get_orgs(gitstats, cache = TRUE, verbose = FALSE)get_orgs(gitstats, cache = TRUE, verbose = FALSE)
gitstats |
A GitStats object. |
cache |
A logical, if set to |
verbose |
A logical, |
A data.frame.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( orgs = c("r-world-devs", "openpharma"), token = Sys.getenv("GITHUB_PAT") ) |> set_gitlab_host( orgs = "mbtests", token = Sys.getenv("GITLAB_PAT_PUBLIC") ) get_orgs(my_gitstats) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( orgs = c("r-world-devs", "openpharma"), token = Sys.getenv("GITHUB_PAT") ) |> set_gitlab_host( orgs = "mbtests", token = Sys.getenv("GITLAB_PAT_PUBLIC") ) get_orgs(my_gitstats) ## End(Not run)
List all pull requests from all repositories for an organization or a vector of repositories.
get_pull_requests( gitstats, since = NULL, until = Sys.Date(), state = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )get_pull_requests( gitstats, since = NULL, until = Sys.Date(), state = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )
gitstats |
A |
since |
A starting date. |
until |
An end date. |
state |
An optional character, by default |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
A table of tibble and gitstats_pull_requests classes.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("openpharma/DataFakeR", "openpharma/visR") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_pull_requests(my_gitstats, since = "2018-01-01", state = "open") ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("openpharma/DataFakeR", "openpharma/visR") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_pull_requests(my_gitstats, since = "2018-01-01", state = "open") ## End(Not run)
Prepare statistics from the pulled pull requests data.
get_pull_requests_stats( pull_requests, time_aggregation = c("year", "month", "week", "day"), group_var )get_pull_requests_stats( pull_requests, time_aggregation = c("year", "month", "week", "day"), group_var )
pull_requests |
A |
time_aggregation |
A character, specifying time aggregation of statistics. |
group_var |
Other grouping variable to be passed to |
To make function work, you need first to get pull requests data with
GitStats. See examples section.
A table of pull_requests_stats class.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("r-world-devs/GitStats", "openpharma/visR") ) |> get_pull_requests(my_gitstats, since = "2022-01-01") |> get_pull_requests_stats( time_aggregation = "month", group_var = author ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), repos = c("r-world-devs/GitStats", "openpharma/visR") ) |> get_pull_requests(my_gitstats, since = "2022-01-01") |> get_pull_requests_stats( time_aggregation = "month", group_var = author ) ## End(Not run)
Pull release logs from repositories.
get_release_logs( gitstats, since = NULL, until = Sys.Date(), cache = TRUE, verbose = FALSE, progress = TRUE )get_release_logs( gitstats, since = NULL, until = Sys.Date(), cache = TRUE, verbose = FALSE, progress = TRUE )
gitstats |
A |
since |
A starting date. |
until |
An end date. |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
A data.frame.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) get_release_logs(my_gistats, since = "2024-01-01") ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) get_release_logs(my_gistats, since = "2024-01-01") ## End(Not run)
Pulls data on all repositories for an organization, individual
user or those with a given text in code blobs (with_code parameter) or a
file (with_files parameter) and parse it into table format.
get_repos( gitstats, add_contributors = TRUE, add_languages = TRUE, with_code = NULL, in_files = NULL, with_files = NULL, language = NULL, cache = TRUE, verbose = FALSE, progress = TRUE, fill_empty_sha = FALSE )get_repos( gitstats, add_contributors = TRUE, add_languages = TRUE, with_code = NULL, in_files = NULL, with_files = NULL, language = NULL, cache = TRUE, verbose = FALSE, progress = TRUE, fill_empty_sha = FALSE )
gitstats |
A GitStats object. |
add_contributors |
A logical parameter to decide whether to add
information about repositories' contributors to the repositories output
(table). If set to |
add_languages |
A logical, |
with_code |
A character vector, if defined, GitStats will pull repositories with specified code phrases in code blobs. |
in_files |
A character vector of file names. Works when |
with_files |
A character vector, if defined, GitStats will pull repositories with specified files. |
language |
A character. If defined, GitStats will return only repositories with given language. |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
fill_empty_sha |
A logical, |
A data.frame.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_repos(my_gitstats) get_repos(my_gitstats, add_contributors = FALSE) get_repos(my_gitstats, add_languages = FALSE) get_repos(my_gitstats, with_code = "Shiny", in_files = "renv.lock") get_repos(my_gitstats, with_files = "DESCRIPTION") ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_repos(my_gitstats) get_repos(my_gitstats, add_contributors = FALSE) get_repos(my_gitstats, add_languages = FALSE) get_repos(my_gitstats, with_code = "Shiny", in_files = "renv.lock") get_repos(my_gitstats, with_files = "DESCRIPTION") ## End(Not run)
Pulls files tree (structure) per repository. Files trees are
then stored as character vectors in files_tree column of output table.
get_repos_trees( gitstats, pattern = NULL, depth = Inf, cache = TRUE, verbose = FALSE, progress = TRUE )get_repos_trees( gitstats, pattern = NULL, depth = Inf, cache = TRUE, verbose = FALSE, progress = TRUE )
gitstats |
A GitStats object. |
pattern |
A regular expression. If defined, it pulls structure of files
in a repository matching this pattern reaching to the level of directories
defined by |
depth |
Defines level of directories to reach for files structure from.
E.g. if set to |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
A tibble.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) get_repos_trees( gitstats = my_gitstats, pattern = "\\.md" ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) get_repos_trees( gitstats = my_gitstats, pattern = "\\.md" ) ## End(Not run)
Pulls a vector of repositories URLs (web or API): either all for
an organization or those with a given text in code blobs (with_code
parameter) or a file (with_files parameter).
get_repos_urls( gitstats, type = "api", with_code = NULL, in_files = NULL, with_files = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )get_repos_urls( gitstats, type = "api", with_code = NULL, in_files = NULL, with_files = NULL, cache = TRUE, verbose = FALSE, progress = TRUE )
gitstats |
A GitStats object. |
type |
A character, choose if |
with_code |
A character vector, if defined, |
in_files |
A character vector of file names. Works when |
with_files |
A character vector, if defined, GitStats will pull repositories with specified files. |
cache |
A logical, if set to |
verbose |
A logical, |
progress |
A logical, by default set to |
A character vector.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_repos_urls(my_gitstats, with_files = c("DESCRIPTION", "LICENSE")) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_repos_urls(my_gitstats, with_files = c("DESCRIPTION", "LICENSE")) ## End(Not run)
GitStats storageRetrieves whole or particular data (see storage parameter)
pulled earlier with GitStats.
get_storage(gitstats, storage = NULL)get_storage(gitstats, storage = NULL)
gitstats |
A GitStats object. |
storage |
A character, type of the data you want to get from storage:
|
A list of tibbles (if storage set to NULL) or a tibble (if
storage defined).
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) get_release_logs(my_gistats, since = "2024-01-01") get_repos(my_gitstats) release_logs <- get_storage( gitstats = my_gitstats, storage = "release_logs" ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) get_release_logs(my_gistats, since = "2024-01-01") get_repos(my_gitstats) release_logs <- get_storage( gitstats = my_gitstats, storage = "release_logs" ) ## End(Not run)
Retrieves metadata (R classes, custom attributes, column types) for a table stored in the active storage backend.
get_storage_metadata(gitstats, storage = NULL)get_storage_metadata(gitstats, storage = NULL)
gitstats |
A GitStats object. |
storage |
A character, name of the table (e.g. |
A list with metadata fields: class, attributes, and (for
database backends) column_types.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = "r-world-devs" ) get_commits(my_gitstats, since = "2024-01-01") get_storage_metadata(my_gitstats, storage = "commits") ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = "r-world-devs" ) get_commits(my_gitstats, since = "2024-01-01") get_storage_metadata(my_gitstats, storage = "commits") ## End(Not run)
Get users data
get_users(gitstats, logins, cache = TRUE, verbose = FALSE)get_users(gitstats, logins, cache = TRUE, verbose = FALSE)
gitstats |
A GitStats object. |
logins |
A character vector of logins. |
cache |
A logical, if set to |
verbose |
A logical, |
A data.frame.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_users(my_gitstats, c("maciekabanas", "marcinkowskak")) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs") ) |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) get_users(my_gitstats, c("maciekabanas", "marcinkowskak")) ## End(Not run)
Returns TRUE when mirai daemons are running on the given
GitStats object (i.e. set_parallel() has been called), FALSE
otherwise.
is_parallel(gitstats)is_parallel(gitstats)
gitstats |
A GitStats object. |
A logical scalar.
## Not run: my_gitstats <- create_gitstats() is_parallel(my_gitstats) ## End(Not run)## Not run: my_gitstats <- create_gitstats() is_parallel(my_gitstats) ## End(Not run)
Is verbose mode switched on
is_verbose(gitstats)is_verbose(gitstats)
gitstats |
A GitStats object. |
GitStats storageRemoves a named table from the active storage backend.
remove_from_storage(gitstats, storage)remove_from_storage(gitstats, storage)
gitstats |
A GitStats object. |
storage |
A character, name of the table to remove (e.g. |
A GitStats object (invisibly).
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = "r-world-devs" ) get_commits(my_gitstats, since = "2024-01-01") remove_from_storage(my_gitstats, storage = "commits") ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = "r-world-devs" ) get_commits(my_gitstats, since = "2024-01-01") remove_from_storage(my_gitstats, storage = "commits") ## End(Not run)
Drops the GitStats schema (with all tables and metadata) from the PostgreSQL database, closes the connection, and reverts storage to the default in-memory local backend. Errors if no PostgreSQL backend is currently set.
remove_postgres_storage(gitstats)remove_postgres_storage(gitstats)
gitstats |
A GitStats object. |
A GitStats object (invisibly).
## Not run: my_gitstats <- create_gitstats() |> set_postgres_storage( dbname = "my_database", host = "localhost", user = "postgres", password = "secret" ) remove_postgres_storage(my_gitstats) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_postgres_storage( dbname = "my_database", host = "localhost", user = "postgres", password = "secret" ) remove_postgres_storage(my_gitstats) ## End(Not run)
Closes the SQLite connection and, for file-based databases, deletes the database file. For in-memory databases the data is simply discarded. Storage is reverted to the default in-memory local backend. Errors if no SQLite backend is currently set.
remove_sqlite_storage(gitstats)remove_sqlite_storage(gitstats)
gitstats |
A GitStats object. |
A GitStats object (invisibly).
## Not run: my_gitstats <- create_gitstats() |> set_sqlite_storage(dbname = "gitstats.sqlite") remove_sqlite_storage(my_gitstats) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_sqlite_storage(dbname = "gitstats.sqlite") remove_sqlite_storage(my_gitstats) ## End(Not run)
Set GitHub host
set_github_host( gitstats, host = NULL, token = NULL, orgs = NULL, repos = NULL, verbose = is_verbose(gitstats), .error = TRUE )set_github_host( gitstats, host = NULL, token = NULL, orgs = NULL, repos = NULL, verbose = is_verbose(gitstats), .error = TRUE )
gitstats |
A GitStats object. |
host |
A character, optional, URL name of the host. If not passed, a public host will be used. |
token |
A token. |
orgs |
An optional character vector of organisations |
repos |
An optional character vector of repositories full names (organization and repository name, e.g. "r-world-devs/GitStats"). |
verbose |
A logical, |
.error |
A logical to control if passing wrong input
( |
If you do not define orgs and repos, GitStats will be set to
scan whole Git platform (such as enterprise version of GitHub or GitLab),
unless it is a public platform. In case of a public one (like GitHub) you
need to define orgs or repos as scanning through all organizations may
take large amount of time.
A GitStats object with added information on host.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( orgs = c("r-world-devs", "openpharma", "pharmaverse") ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( orgs = c("r-world-devs", "openpharma", "pharmaverse") ) ## End(Not run)
Set GitLab host
set_gitlab_host( gitstats, host = NULL, token = NULL, orgs = NULL, repos = NULL, verbose = is_verbose(gitstats), .error = TRUE )set_gitlab_host( gitstats, host = NULL, token = NULL, orgs = NULL, repos = NULL, verbose = is_verbose(gitstats), .error = TRUE )
gitstats |
A GitStats object. |
host |
A character, optional, URL name of the host. If not passed, a public host will be used. |
token |
A token. |
orgs |
An optional character vector of organisations |
repos |
An optional character vector of repositories full names (organization and repository name, e.g. "r-world-devs/GitStats"). |
verbose |
A logical, |
.error |
A logical to control if passing wrong input
( |
If you do not define orgs and repos, GitStats will be set to
scan whole Git platform (such as enterprise version of GitHub or GitLab),
unless it is a public platform. In case of a public one (like GitHub) you
need to define orgs or repos as scanning through all organizations may
take large amount of time.
A GitStats object with added information on host.
## Not run: my_gitstats <- create_gitstats() |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_gitlab_host( token = Sys.getenv("GITLAB_PAT_PUBLIC"), orgs = "mbtests" ) ## End(Not run)
Reset storage to the default in-memory backend.
set_local_storage(gitstats)set_local_storage(gitstats)
gitstats |
A GitStats object. |
A GitStats object (invisibly).
## Not run: my_gitstats <- create_gitstats() |> set_local_storage() ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_local_storage() ## End(Not run)
Set up parallel processing for API calls using mirai daemons.
When enabled, GitStats fetches data from multiple repositories
concurrently. Call set_parallel(FALSE) or set_parallel(0) to revert
to sequential execution.
set_parallel(gitstats, workers = 10L)set_parallel(gitstats, workers = 10L)
gitstats |
A GitStats object. |
workers |
Number of parallel workers. Set to |
A GitStats object.
## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) |> set_parallel(4) get_commits(my_gitstats, since = "2024-01-01") my_gitstats |> set_parallel(FALSE) # revert to sequential ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_github_host( token = Sys.getenv("GITHUB_PAT"), orgs = c("r-world-devs", "openpharma") ) |> set_parallel(4) get_commits(my_gitstats, since = "2024-01-01") my_gitstats |> set_parallel(FALSE) # revert to sequential ## End(Not run)
Persist GitStats data in a PostgreSQL database. R classes,
custom attributes, and column types are preserved via a _metadata table.
Requires DBI, RPostgres, and jsonlite packages.
set_postgres_storage( gitstats, host = NULL, port = NULL, dbname = NULL, user = NULL, password = NULL, schema = "git_stats", ... )set_postgres_storage( gitstats, host = NULL, port = NULL, dbname = NULL, user = NULL, password = NULL, schema = "git_stats", ... )
gitstats |
A GitStats object. |
host |
A character, database host. |
port |
An integer, database port. |
dbname |
A character, database name. |
user |
A character, database user. |
password |
A character, database password. |
schema |
A character, database schema (default |
... |
Additional arguments passed to
|
A GitStats object (invisibly).
## Not run: my_gitstats <- create_gitstats() |> set_postgres_storage( dbname = "my_database", host = "localhost", user = "postgres", password = "secret" ) ## End(Not run)## Not run: my_gitstats <- create_gitstats() |> set_postgres_storage( dbname = "my_database", host = "localhost", user = "postgres", password = "secret" ) ## End(Not run)
Persist GitStats data in a SQLite database. R classes,
custom attributes, and column types are preserved via a _metadata table.
Requires DBI, RSQLite, and jsonlite packages.
set_sqlite_storage(gitstats, dbname = ":memory:")set_sqlite_storage(gitstats, dbname = ":memory:")
gitstats |
A GitStats object. |
dbname |
A character, path to SQLite file. Defaults to |
A GitStats object (invisibly).
## Not run: # File-based my_gitstats <- create_gitstats() |> set_sqlite_storage(dbname = "gitstats.sqlite") # In-memory my_gitstats <- create_gitstats() |> set_sqlite_storage() ## End(Not run)## Not run: # File-based my_gitstats <- create_gitstats() |> set_sqlite_storage(dbname = "gitstats.sqlite") # In-memory my_gitstats <- create_gitstats() |> set_sqlite_storage() ## End(Not run)
GitStats
Retrieves hosts set by GitStats with set_*_host() functions.
show_hosts(gitstats)show_hosts(gitstats)
gitstats |
A GitStats object. |
A list of hosts.
GitStats
Retrieves organizations set or pulled by GitStats. Especially
helpful when user is scanning whole git platform and wants to have a
glimpse at organizations.
show_orgs(gitstats)show_orgs(gitstats)
gitstats |
A GitStats object. |
A vector of organizations.
Stop printing messages and output.
verbose_off(gitstats)verbose_off(gitstats)
gitstats |
A GitStats object. |
A GitStats object.
Print all messages and output.
verbose_on(gitstats)verbose_on(gitstats)
gitstats |
A GitStats object. |
A GitStats object.