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:
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 df[1, "Description"] |> strtrim(60) |> paste("[...]")  "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.