Learn R Programming

DCC (version 1.2.1)

dcc_item_map: Master item map of a form-mapped dataset

Description

Returns the resolved form-to-master item map attached by dcc_map_forms. This is the public accessor for the mapping; callers should not read the hidden attribute directly.

Usage

dcc_item_map(x)

Value

The item-map data.frame (master, form, source, is_anchor, ...).

Arguments

x

A dcc_data returned by dcc_map_forms.

Examples

Run this code
data <- data.frame(sid = c("S1", "S2"), form = c("A", "B"),
                   p1 = c(1, 2), p2 = c(5, 6))
fmap <- data.frame(form = c("A", "A", "B", "B"),
                   source = c("p1", "p2", "p1", "p2"),
                   master = c("M001", "M002", "M003", "M002"),
                   is_anchor = c(FALSE, TRUE, FALSE, TRUE))
mapped <- dcc_map_forms(data, fmap, form_var = "form")
dcc_item_map(mapped)

Run the code above in your browser using DataLab