checkDesign: Check Datasets for Deviations From Test Design

View source: R/checkDesign.r

checkDesignR Documentation

Check Datasets for Deviations From Test Design

Description

This function checks whether a data frame corresponds to a particular rotated block design, i.e. whether all persons have valid codes on all items they were presented with and one consistent missing code for all items they were not presented with.

Usage

checkDesign(dat, booklets, blocks, rotation, sysMis="NA", id="ID",
    subunits = NULL, verbose = TRUE)

Arguments

dat

A data frame

booklets

A data frame containing information about the number of blocks in each booklet and the names of these blocks with column names 'subunit', 'block', 'subunitBlockPosition'. See ‘Examples’.

blocks

A data frame containing the names of subunits and their order within each block with column names 'booklet', 'block1', 'block2' ... etc. See ‘Examples’.

rotation

A data frame containing information about which participant worked on which booklet with column names [id as specified above], 'booklet'. See ‘Examples’.

sysMis

A character vector of length 1 indicating the missing code for items that were not administered to a participant. Default is "NA".

id

A character vector of length 1 indicating the name of the participant identifier variable in dat. Default is ID.

subunits

Optional: A data frame with subunit information (c.f. inputList). This data frame is used to identify the names of recoded subunits.

verbose

logical. If FALSE, no information is printed.

Author(s)

Karoline Sachse, Philipp Franikowski

Examples

data(inputDat)
data(inputList)

prepDat <- automateDataPreparation (inputList = inputList, datList = inputDat,
    readSpss = FALSE, checkData = FALSE, mergeData = TRUE, recodeData = TRUE,
    aggregateData = FALSE, scoreData = FALSE, writeSpss = FALSE, verbose = TRUE)

checkDesign(dat = prepDat, booklets = inputList$booklets, blocks = inputList$blocks,
    rotation = inputList$rotation, sysMis = "mbd", id="ID",
    subunits = inputList$subunits, verbose = TRUE)

prepDat[1:7,"I22R"] <- "1"
prepDat[1:4,c("I01R","I02R","I03R")] <- "mbd"

checkDesign(dat = prepDat, booklets = inputList$booklets, blocks = inputList$blocks,
    rotation = inputList$rotation, sysMis = "mbd", id="ID",
    subunits = inputList$subunits, verbose = TRUE)

sachseka/eatPrep documentation built on June 9, 2025, 9:36 a.m.