Skip to contents

Fixes the version of one IRW dataset for the remainder of the R session, so that fetches, listings, and metadata are reproducible. Pin at the top of an analysis script and the script will return the same data when it is re-run, even after IRW has been updated.

Usage

irw_set_version(dataset, version)

Arguments

dataset

Character. Name of the IRW dataset to pin, e.g. "item_response_warehouse". See irw_get_version() for the full list.

version

Character. A released version tag, e.g. "v32.0" (a leading "v" is optional).

Value

Invisibly, the named character vector of all pins in effect.

Details

The pin covers every lookup that reads the dataset, not just fetches: irw_fetch(), irw_filter(), irw_list_tables(), and metadata all read the pinned version.

Each IRW dataset is versioned independently on Redivis, so pinning is per-dataset. irw_get_version() reports the versions currently in use, which is how you find the tags to write into a script.

A table that does not exist in the pinned version is an error rather than a silent fetch from the current release: quietly mixing versions would break the reproducibility the pin exists to provide.

Examples

if (FALSE) { # \dontrun{
irw_set_version("item_response_warehouse", "v32.0")
irw_set_version("item_response_warehouse_2", "v1.8")

df <- irw_fetch("kfcovid_fear_Li2020")   # served from v32.0

irw_reset_version()                      # back to the current release
} # }