Skip to contents

Pins every IRW dataset at once to what a single IRW version held, so that irw_fetch() and everything around it return the same data whenever the script is re-run – even after IRW has been corrected or extended. This is the reproducibility switch: put one call at the top of an analysis and the rest of the script is frozen.

Usage

irw_use_version(version = NULL, date = NULL, quiet = FALSE)

Arguments

version

Optional IRW version number, e.g. 332. Defaults to the newest version.

date

Optional date or time to pin the corpus as it was then, e.g. "2026-08-01". Mutually exclusive with version.

quiet

Logical. Suppress the per-dataset summary.

Value

Invisibly, a data frame of dataset and version as pinned, with the IRW version number in the attribute irw_version.

Details

irw_use_version(332)
df <- irw_fetch("gilbert_meta_12")   # v332's copy, today and next year

Called with no arguments it pins the newest version and reports its number: run it at the start of a project and record the number it prints.

The pin covers the metadata and item text datasets too, not just response data, and lasts for the session; irw_reset_version() lifts it.

Each dataset is pinned to its own version

The response data is spread over several Redivis warehouses ("shards"), each released on its own schedule, so one IRW version means a different Redivis version in each. That is handled: every dataset is pinned to the tag the manifest records for it, and a single irw_fetch() call may read several shards at different versions.

irw_use_version(200)   # shard 1 at v36.0, shard 2 at v3.3
L <- irw_fetch(c("idcr_martinez_2023_numSeries", "gcb5_2025"))

A dataset that did not exist yet

Not every IRW dataset has a release in every IRW version – the sixth warehouse shard is younger than the first. Rather than let those fall through to the current release and silently mix versions into a "reproduced" run, they are pinned to nothing and error if something reads them. Fetches are unaffected: a table that did not exist then is simply not found.

Prefer a version number to a date

A date has to be resolved to a version, and before 21 July 2026 that resolution is approximate for the older warehouse shards – see irw_version(). Pinning by date therefore warns; pinning by number never has to.

Examples

if (FALSE) { # \dontrun{
irw_use_version(332)              # read the corpus as v332 held it
irw_use_version()                 # freeze today's version; record the number
irw_use_version(date = "2026-08-01")
irw_reset_version()               # back to the current release
} # }