R packages

The most commonly used language in the department is R, and so we have written many R packages to support research. These:

beers - interpolation and subdivision for demography

A small package that implements the Beers ordinary and modified methods, notably used by UNWPP to subdivide 5-year age groups into single years of age, and interpolate 5-year time points down to single years of time.

cinterpolate - interpolation from C, for R

A small utility R package for interpolation (piecewise constant, linear and spline) from C for use within R packages

cyphr - easy to use encryption for R

A high-level approach to make using encryption from R more accessible; the cyphr package wraps the openssl and sodium packages to provide a common interface, along with abstractions to make encryption easier for data analysts.

(This is also an rOpenSci package.)

dde - an R package for solving delay differential equations

The dde package implements a simple solver for delay differential equations (DDEs), which are an extension to ordinary differential equations (ODEs) where the derivatives depend not only on the current state but also on the state at some point in the model’s past. They turn up modelling contexts (e.g., the number of people bitten by mosquitos 10 days ago).

dettl - ETL (Extract-Transform-Load) support

We wrote this package to support our work with the Vaccine Impact Modelling Consortium, to allow reviewable and testable data uploads into our databases.

dust - fast parallel stochastic simulation

A low-level package which provides tools to help write stochastic models that can be evaluated in parallel. It contains an implemenation of the xoshiro random number generators, exists to support large stochastic compartmental models written in odin using odin.dust. Models can be run in parallel on a CPU using OpenMP, but also on NVIDIA GPUs using CUDA (see benchmarks for the particle filter and random number generators)

fakerbase - fake database tables for unit testing

Lightweight fake tables that automatically conform to a database schema, used to replace databases in tests. Currently used in vimpact to replace a complex Postgres database.

ids - simple random identifiers

Random idenfiers in a number of different forms, including random hex strings (e.g., 8fa9afdd5bc04b3732fd07ddde865f48) to human-readable/semi-memorable phrases (bombastic_anteater or 3_bashful_rabbits_spying_obnoxiously). We use this package anywhere we need random keys.

jsonvalidate - JSON schema validation for R

JSON schemas provide a mechanism for validating that JSON conforms to an expected structure. This R package wraps two popular JSON schema libraries written in javascript - is-my-json-valid and ajv.

(This is also an rOpenSci package.)

mcstate - Monte Carlo methods for state space models

Implements some sequential Monte Carlo methods used with state state models, including a bootstrap particle filter, particle MCMC (pmcmc), SMC^2 and IF2

odin - high level differential equations

A “domain specific language”, hosted in R, for representing and compiling ordinary differential equations. odin provides a language that has the same syntax as R but compiles to C (or to R or JavaScript) in order to represent equations at a high level but allow high-performance solutions. Currently odin is being used within the department for research on malaria, measles, HIV and flu.

orderly - lightweight reproducible reporting

A lightweight system for reproduducible reporting, in R. Composed of an R package, orderly and a web application, OrderlyWeb, orderly makes it straightforward to associate analyses with their inputs, version outputs and organise and distribute everything with a user-friendly front-end. The researcher-friendly framework makes very few restrictions on how analyses are carried out.

porcelain - testable HTTP API packages

An opinionated way of structuring plumber APIs (simple HTTP APIs written in R, similar to flask in Python). On top of the system provided by plumber, porcelain adds validation of json requests and responses (using jsonvalidate), easier unit and integration testing, and integration with roxygen2.

rrq - distributed task queues with Redis

Uses redis to build a task queue, supporting both lightweight tasks and isolated tasks in separate processes. It can scale to potentially hundreds of workers, and these can be added to or removed from the pool at any time. Queue operations can be blocking or nonblocking, and run with minimal overhead (on the order of 1/1000s per task). We use this on our HPC jobs as a less-invasive alternative to MPI, and in projects like naomi.

spud - sharepoint upload and download

Simple interface to Sharepoint allowing uploading and downloading of files. Much less fully featured than Microsoft365R but does not require that the site administrators have enabled exotic API endpoints.

traduire - internationalisation for R packages

The traduire R package provides a wrapper around the i18next JavaScript library. It presents an alternative interface to R’s built-in internationalisation functions, with a focus on the ability to change the target language within a session. We use this to support dynamic translation of hintr which is a porcelain API to naomi - see the naomi project page for more information.

vaultr - an R client for Vault

The R package vaultr is a client for HashiCorp’s “vault”, a system for storing secrets and sensitive data and enabling these secrets to be used in applications.