addComplement

0th

Percentile

Add Complement-items to Transactions

Provides the generic function 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.

Keywords
manip
Usage
addComplement(x, labels, complementLabels=NULL)
Arguments
x

an object of class transactions.

labels

character strings; item labels for which complements should be created.

complementLabels

character strings; labels for the artificial complement-items. If omitted then the original label is prepended by "!" to form the complement-item label.

Value

Returns an object of class transactions with complement-items added.

See Also

transactions-class, merge

Aliases
  • addComplement
  • addComplement,transactions-method
Examples
# NOT RUN {
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))
# }
Documentation reproduced from package arules, version 1.5-4, License: GPL-3

Community examples

Looks like there are no examples yet.