
addComplement
and the S4 methods for
transactions. This function adds for given items complement items. That is
it adds an artificial item to each transactions which does not
contain the original item.addComplement(x, labels, complementLabels=NULL)
transactions
.transactions
with complement-items added.transactions-class
,
merge
data("Groceries")
## add a complement-items for "whole milk" and "other vegetables"
g2 <- addComplement(Groceries, c("whole milk", "other vegetables"))
inspect(head(g2, 3))
## use a custom label for the complement-item
g2 <- addComplement(g2, "coffee", "NO coffee")
inspect(head(g2, 3))
Run the code above in your browser using DataLab