Skip to contents

Retrieves one or more tables from IRW and returns them as tibbles. This downloads every row of each table and counts against the Redivis export quota; if you only need the item or response value sets, or per-item counts and ranges, use irw_table_sets(), which answers with a server-side query. If the table includes a character resp column, the function attempts to coerce it into numeric. Strings like "NA", "", and NA are treated as missing values. A warning is issued only if other non-numeric values are encountered.

Usage

irw_fetch(
  name,
  source = "core",
  dedup = FALSE,
  sim = FALSE,
  comp = FALSE,
  nom = FALSE,
  resp = FALSE
)

Arguments

name

Character vector of one or more table names (IRW table IDs).

source

Character. Data source: "core" (default), "nom", "sim", or "comp".

dedup

Logical, optional. If TRUE, deduplicates responses based on timing variables. Defaults to FALSE. If a date column is present, no deduplication is performed. If only a wave column is present, one random response is retained per (id, item) group within each wave. If neither date nor wave is present, one random response is retained per (id, item) pair.

sim

Deprecated. Use source = "sim" instead.

comp

Deprecated. Use source = "comp" instead.

nom

Deprecated. Use source = "nom" instead.

resp

Logical, optional. If TRUE, returns response matrix via irw_long2resp(). Defaults to FALSE.

Value

If a single name is provided, returns a tibble. If multiple, returns a named list of tibbles (or error messages, if retrieval failed).

Details

Each table downloaded is also kept on disk (see irw_cache_dir()) and reused by later fetches, in this session or another, for as long as the table is unchanged on Redivis; the Python package shares the same copies. Switch this off with options(irw.cache = FALSE) or IRW_CACHE=0.

A table the IRW found through another collection, such as openESM, prints that collection's note and citation once per session per collection. Silence it with options(irw.source_note = FALSE) or IRW_SOURCE_NOTE=0.

See also

irw_table_sets() for value sets and summaries without a download; irw_cache_info() for the tables kept on disk.

Examples

if (FALSE) { # \dontrun{
# Main IRW data
irw_fetch("environment_ltm")

# Deduplicated
irw_fetch("pks_probability", dedup = TRUE)

# Simulation data
irw_fetch("gilbert_meta_3", source = "sim")

# Competition data
irw_fetch("collegefb_2021and2022", source = "comp")
} # }