R Client for R-universe APIs

[This article was first published on Valerio Gherardi, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


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("[...]")
[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.

To leave a comment for the author, please follow the link and comment on their blog: Valerio Gherardi.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)