Learn R Programming

arules (version 0.2-6)

subset: 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, ...)

## S3 method for class 'itemMatrix': subset(x, subset, ...)

## S3 method for class 'itemsets': subset(x, subset, ...)

## S3 method for class 'rules': subset(x, subset, ...)

## S3 method for class '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

Run this code
data("Adult")
rules <- apriori(Adult)

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

Run the code above in your browser using DataLab