{runi}, an R package to interact with R-universe repository APIs
Following my previous post on how to use your R-universe API to automatically generate a list of the packages on your R-universe, I started working on a simple R client to interact with such APIs.
For those who missed it, R-universe is a new project from rOpenSci that allows you to mantain a personal CRAN-like repository, which automatically syncs with the GitHub repositories hosting your projects.
Among other features, each repository has associated a RESTful API with which users can interact for managing and retrieving informations about packages in the repo. Quoting R-universe:
The package server provides REST APIs for managing package submissions and querying information about individual packages as well as on the repository level. These data can be accessed programmatically or displayed in a front-end dashboard.
I started playing around to implement an R client for R-universe APIs. The package is called runi
and the code is here. Up to now, only a small subset of the full API features are available. You can peek at the development version from GitHub, using:
::install_github("vgherard/runi") remotes
For instance, the procedure for obtaining your packages DESCRIPTION outlined in my previous post is performed by:
df <- runi::runi_stats_descriptions("vgherard") # 'vgherard' is my R-universe name.
df
is a dataframe containing all the entries of the DESCRIPTION files of my packages:
df[, c("Package", "Title")]
# A tibble: 6 × 2
Package Title
<chr> <chr>
1 scribblr A Notepad Inside RStudio
2 kgrams Classical k-gram Language Models
3 fcci Feldman-Cousins Confidence Intervals
4 r2r R-Object to R-Object Hash Maps
5 gsample Efficient Weighted Sampling Without Replacement
6 sbo Text Prediction via Stupid Back-Off N-Gram Models
[1] "A project aware notepad inside RStudio, for taking quick\nproj [...]"
If you see mistakes or want to suggest changes, please create an issue on the source repository.
Text and figures are licensed under Creative Commons Attribution CC BY-SA 4.0. Source code is available at https://github.com/vgherard/vgherard.github.io/, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Gherardi (2021, July 25). vgherard: R Client for R-universe APIs. Retrieved from https://vgherard.github.io/posts/2021-07-25-r-client-for-r-universe-apis/
BibTeX citation
@misc{gherardi2021r, author = {Gherardi, Valerio}, title = {vgherard: R Client for R-universe APIs}, url = {https://vgherard.github.io/posts/2021-07-25-r-client-for-r-universe-apis/}, year = {2021} }