Learn R Programming

DCC (version 1.2.1)

dcc_map_forms: Map multi-form responses onto the master item bank

Description

Aligns item columns from multiple test forms onto the master item bank using an external form-item mapping table. Items not administered on a respondent's form are structural NA -- the concurrent-calibration layout consumed by the downstream IRTC engine. Anchor flags are carried through for fixed-anchor equating. Mapping problems are findings (MAP_SOURCE_MISSING, MAP_UNKNOWN_FORM), not silent drops.

Usage

dcc_map_forms(x, form_item_map, form_var)

Value

A new dcc_data version: non-item columns pass through, consumed source columns are dropped, one column per master item is appended (NA where not administered). The normalized item map (with is_anchor) is attached as the dcc_item_map

attribute, mapping findings as the dcc_findings attribute, and a map_forms provenance record is appended.

Arguments

x

A dcc_data object or data.frame of responses.

form_item_map

A data.frame with columns form, source (item column on that form), master (master item bank id) and optionally is_anchor (logical, default FALSE) -- or a path to a CSV file with those columns (hash recorded in provenance).

form_var

Name of the column in x holding each respondent's form id.

Examples

Run this code
df <- data.frame(sid = c("S1", "S2"), form = c("A", "B"),
                 p1 = c("X", "Y"))
map <- data.frame(form = c("A", "B"), source = c("p1", "p1"),
                  master = c("M001", "M002"))
as.data.frame(dcc_map_forms(df, map, form_var = "form"))

Run the code above in your browser using DataLab