by Kamil Wais

The RDO R package allows you to create and interact with Reproducible Data Objects (RDO). An RDO object encapsulates both data and R code needed to reproduce the data.

The development of the RDO package is supported by Roche.

Package documentation: openpharma.github.io/RDO

RDOs can have other RDOs as dependencies and can be composed into complex hierarchy (RDO trees).

Interacting with such RDO tree is similar to interacting with a single RDO, as each RDO has the same programming interface thanks to composite programming design pattern.

You can (re)run the RDO reproducible code and refresh the data cache, check status, validate if the code still gives the same cached data, clear data cache, access code and data cache of any of the dependencies.

Both a single RDO and a complex RDO tree can be cloned, and code of the cloned dependencies can be also modified later.

Installation

You can install the released version of RDO from CRAN with:

And the development version from GitHub with:

Basic example

Let’s assume we have some exemplary R code that changes a dataset in some way:

Now, we would like to encapsulate this code and the changed data inside an RDO.

The RDO is an R6 class so to create a new RDO object just use the constructor function:

Now we can add the reproducible R code as an R expression.

If we have a code, we can run it and the result will be cached inside RDO.

We can now access the cache…

Let’s see if the RDO is validated…

The RDO is validated, so we can be pretty sure that last evaluation of the code give in result the cached data.

Let’s update the code just a bit and check the validation status…

The RDO is NOT validated! We need to update the cache…

We have a validated RDO. At any time we can extract the cached data and the reproducible R code.