itemTuples {eatATA} | R Documentation |
Create item tuples.
Description
If item inclusions or exclusions are stored as a character vector, itemTuples
separates this vector and creates item pairs ('tuples').
Usage
itemTuples(items, idCol = "ID", infoCol, sepPattern = ", ")
Arguments
items |
A |
idCol |
character or integer indicating the item ID column in |
infoCol |
character or integer indicating the column in |
sepPattern |
String which should be used for separating item IDs in the |
Details
Tuples can be used by itemExclusionConstraint
to set up exclusion constraints
and by itemInclusionConstraint
to set up inclusion constraints. Note that a
separator pattern has to be used consistently throughout the column (e.g. ", "
).
Value
A data.frame
with two columns.
Examples
# Example data.frame
items <- data.frame(ID = c("item1", "item2", "item3", "item4"),
exclusions = c("item2, item3", NA, NA, NA))
# Create tuples
itemTuples(items = items, idCol = "ID", infoCol = 2,
sepPattern = ", ")
[Package eatATA version 1.1.2 Index]