View source: R/itemExclusionConstraint.R
itemExclusionConstraint | R Documentation |
Create constraints that prohibit that item pairs occur in the same test forms (exclusions) or force item pairs to be in the same test forms (inclusions).
itemExclusionConstraint( nForms, itemTuples, itemIDs, whichForms = seq_len(nForms), info_text = NULL ) itemInclusionConstraint( nForms, itemTuples, itemIDs, whichForms = seq_len(nForms), info_text = NULL )
nForms |
Number of forms to be created. |
itemTuples |
|
itemIDs |
Character vector of item IDs in correct ordering. |
whichForms |
An integer vector indicating which test forms should be constrained. Defaults to all the test forms. |
info_text |
a character string of length 1, to be used in the |
Item tuples can, for example, be created by the function itemTuples
.
An object of class "constraint"
.
itemExclusionConstraint()
: item pair exclusion constraints
itemInclusionConstraint()
: item pair inclusion constraints
## Simple Exclusion Example # item-IDs IDs <- c("item1", "item2", "item3", "item4") # exclusion tuples: Item 1 can not be in the test form as item 2 and 3 exTuples <- data.frame(v1 = c("item1", "item1"), v2 = c("item2", "item3"), stringsAsFactors = FALSE) # inclusion tuples: Items 2 and 3 have to be in the same test form inTuples <- data.frame(v1 = c("item2"), v2 = c("item3"), stringsAsFactors = FALSE) # create constraints itemExclusionConstraint(nForms = 2, itemTuples = exTuples, itemIDs = IDs) itemInclusionConstraint(nForms = 2, itemTuples = inTuples, itemIDs = IDs) ######## ## Full workflow for exclusions using itemTuples # Example data.frame items <- data.frame(ID = c("item1", "item2", "item3", "item4"), infoCol = c("item2, item3", NA, NA, NA)) # Create tuples exTuples2 <- itemTuples(items = items, idCol = "ID", infoCol = "infoCol", sepPattern = ", ") ## Create constraints itemExclusionConstraint(nForms = 2, itemTuples = exTuples2, itemIDs = IDs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.