https://github.com/turtletopia/woodendesc
Get the available packages and their version codes as well as their dependencies from any R repository with unified API.
https://github.com/turtletopia/woodendesc
available-packages available-versions dependencies r unified-api
Last synced: 4 months ago
JSON representation
Get the available packages and their version codes as well as their dependencies from any R repository with unified API.
- Host: GitHub
- URL: https://github.com/turtletopia/woodendesc
- Owner: turtletopia
- License: gpl-3.0
- Created: 2022-04-08T13:17:26.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-27T08:05:36.000Z (11 months ago)
- Last Synced: 2024-06-04T23:02:43.506Z (10 months ago)
- Topics: available-packages, available-versions, dependencies, r, unified-api
- Language: R
- Homepage: https://turtletopia.github.io/woodendesc/
- Size: 17.7 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - turtletopia/woodendesc - Get the available packages and their version codes as well as their dependencies from any R repository with unified API. (R)
README
---
output: github_document
---```{r, include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "90%"
)
library(woodendesc)
```[](https://CRAN.R-project.org/package=woodendesc)
[](https://turtletopia.r-universe.dev)
[](https://github.com/turtletopia/woodendesc/actions)
[](https://app.codecov.io/gh/turtletopia/woodendesc?branch=master){woodendesc} strives to provide an unified API to query any R repository for the following data:
* list of available packages,
* version code of any selected package,
* direct dependencies of any selected package.The package tries to cache as much as possible and reuse existing cache wherever possible to minimize internet usage. Many repositories (CRAN, Bioconductor, R-universe, and local libraries) have custom implementations of their handlers to make use of additional possibilities they present (e.g. previous versions on CRAN or old releases of Bioconductor).
## Installation
```{r install, eval=FALSE}
# Install from CRAN
install.packages("woodendesc")
# Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("turtletopia/woodendesc")
```## How to use woodendesc?
Each repository has its dedicated functions for listing available packages, package version, and package dependencies.
A list of available packages is returned as a character vector. An example call returning a list of CRAN packages:
```{r demo_cran_pkgs, cache=TRUE}
library(woodendesc)
# Too many packages to list them all
all_cran_pkgs <- wood_cran_packages()
head(all_cran_pkgs, 10)
```An available package version is returned as a single code. An example call checking the current version of Biobase package on Bioconductor:
```{r demo_bioc_version, cache=TRUE}
wood_bioc_version("Biobase")
```Dependencies of a package are returned as a data frame with the same set of columns for all calls. An example call for locally installed digest package (dependency of woodendesc):
```{r demo_local_deps, cache=TRUE}
wood_local_dependencies("digest")
```Note that some repositories store more than just one version of a package (e.g. CRAN and Github). These cases can be distinguished by pluralized `_versions` function name component and they return all version codes instead; a character vector of any length. This is how it works for gglgbtq on Github:
```{r demo_gh_versions, cache=TRUE}
wood_github_versions("gglgbtq", "turtletopia")
```If a single version code is needed, there's a counterpart that selects the latest version only. The current version of aurrera on Github is:
```{r demo_gh_latest, cache=TRUE}
wood_github_latest("aurrera", "turtletopia")
```Last, but not least, there are three functions for searching through multiple repositories and collecting the results. Read the documentation for details on how to specify `repos` parameter.
`wood_packages()` collects available packages from the specified repositories and returns unique elements:
```{r demo_wood_packages, cache=TRUE}
wood_packages(repos = c("core", "https://colinfay.me"))
````wood_versions()` returns all package versions available on at least one of the specified repositories; may take more than one package:
```{r demo_wood_versions, cache=TRUE}
wood_versions(
c("aurrera", "woodendesc"),
repos = c("local#all", "runiverse@turtletopia", "cran")
)
````wood_dependencies()` returns a list of package dependencies, a data frame for each package specified; the first working repository is used for each package, as the dependencies are not supposed to be summable:
```{r demo_wood_deps, cache=TRUE}
wood_dependencies(
c("versionsort", "gglgbtq"),
repos = c("local#all", "runiverse@turtletopia", "cran")
)
```And if you ever need to clear cache, simply call:
```{r clear_cache}
wood_clear_cache()
```## End notes
I believe in equal rights and treatment for everybody, regardless of their sexuality, gender identity, skin tone, nationality, and other features beyond human control. Thus, I do not allow woodendesc to be used in any project that promotes hate based on the aforementioned factors.