Learn R Programming

arules (version 0.2-1)

combine: Combining Objects

Description

Provides the generic function combine and the S4 methods to combine several objects based on itemMatrix into a single object. For example, to combine several mined itemsets (or rules) into a single set.

Usage

combine(first, ...)
## S3 method for class 'itemMatrix':
combine(first, ..., as_list)
## S3 method for class 'transactions':
combine(first, ...)
## S3 method for class 'rules':
combine(first, ...)
## S3 method for class 'itemsets':
combine(first, ...)

Arguments

first
first object.
...
further objects to be combined.
as_list
used internally.

Value

  • An object of the same class as first.

See Also

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

Examples

Run this code
data("Adult_transactions")

### combine transactions
a1 <- Adult_transactions[1:10]
a2 <- Adult_transactions[101:110]

a_comb <- combine(a1, a2)
summary(a_comb)

### combine rules
r1 <- apriori(Adult_transactions[1:1000])
r2 <- apriori(Adult_transactions[1001:2000])
r_comb <- unique(combine(r1, r2)) 
r_comb

Run the code above in your browser using DataLab