Introducing W.I.P. {runiv}, 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.
Since this has already proved to be useful to me (and could hopefully be so also to others), I started playing around to implement an R client for R-universe APIs. The package is called runiv
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/runiv") remotes
For instance, the procedure for obtaining your packages DESCRIPTION outlined in my previous post is performed by:
df <- runiv::runiv_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")]
Package Title
1 r2r R-Object to R-Object Hash Maps
2 kgrams Classical k-gram Language Models
3 scribblr A Notepad Inside RStudio
4 gsample Efficient Weighted Sampling Without Replacement
5 sbo Text Prediction via Stupid Back-Off N-Gram Models
6 fcci Feldman-Cousins Confidence Intervals
[1] "Implementation of hash tables (hash sets and hash maps) in R [...]"
I hope you find this useful. I have very little experience with web API R packages (this was another personal reason to tackle this), so that if you have any suggestion, or maybe want to collaborate on runiv
, you are welcome to reach out to me through GitHub.
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
vgherard (2021, July 25). Valerio Gherardi: 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{vgherard2021r, author = {vgherard, }, title = {Valerio Gherardi: R Client for R-universe APIs}, url = {https://vgherard.github.io/posts/2021-07-25-r-client-for-r-universe-apis/}, year = {2021} }