subset {arules}R Documentation

Subsetting Itemsets, Rules and Transactions

Description

Provides the generic function subset and S4 methods to subset associations or transactions (itemMatrix) which meet certain conditions (e.g., contains certain items or satisfies a minimum lift).

Usage

subset(x, ...)

## S4 method for signature 'itemMatrix':
subset(x, subset, ...)

## S4 method for signature 'itemsets':
subset(x, subset, ...)

## S4 method for signature 'rules':
subset(x, subset, ...)

## S4 method for signature 'itemMatrix':
subset(x, subset, ...)

Arguments

x object to be subsetted.
subset logical expression indicating elements to keep.
... further arguments to be passed to or from other methods.

Value

An object of the same class as x containing only the elements which satisfy the conditions.

See Also

itemMatrix-class, itemsets-class, rules-class, transactions-class

Examples

data("Adult")
rules <- apriori(Adult)

### subset the rules
rules.sub <- subset(rules, subset = rhs %in% "marital-status=Never-married" 
    & lift > 2)

[Package arules version 0.4-4 Index]