combine: Combining Objects

Description Usage Arguments Value Author(s) See Also Examples

Description

Provides the S4 methods to combine several objects based on itemMatrix into a single object.

Note, use union rather than c to combine several mined itemsets (or rules) into a single set.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S4 method for signature 'itemMatrix'
c(x, ..., recursive = FALSE)

## S4 method for signature 'transactions'
c(x, ..., recursive = FALSE)

## S4 method for signature 'rules'
c(x, ..., recursive = FALSE)

## S4 method for signature 'itemsets'
c(x, ..., recursive = FALSE)

Arguments

x

first object.

...

further objects of the same class as x to be combined.

recursive

a logical. If recursive=TRUE, the function recursively descends through lists combining all their elements into a vector.

Value

An object of the same class as x.

Author(s)

Michael Hahsler

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data("Adult")

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

aComb <- c(a1, a2)
summary(aComb)

## combine rules (can contain the same rule multiple times)
r1 <- apriori(Adult[1:1000])
r2 <- apriori(Adult[1001:2000])
rComb <- c(r1, r2) 
rComb

## union of rules (a set with only unique rules: same as unique(rComb))
rUnion <- union(r1,r2)
rUnion

Example output

Loading required package: Matrix

Attaching package: 'arules'

The following objects are masked from 'package:base':

    abbreviate, write

transactions as itemMatrix in sparse format with
 20 rows (elements/itemsets/transactions) and
 115 columns (items) and a density of 0.1121739 

most frequent items:
           capital-loss=None native-country=United-States 
                          20                           18 
                  race=White            capital-gain=None 
                          17                           14 
    hours-per-week=Full-time                      (Other) 
                          14                          175 

element (itemset/transaction) length distribution:
sizes
11 13 
 1 19 

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   11.0    13.0    13.0    12.9    13.0    13.0 

includes extended item information - examples:
           labels variables      levels
1       age=Young       age       Young
2 age=Middle-aged       age Middle-aged
3      age=Senior       age      Senior

includes extended transaction information - examples:
  transactionID
1             1
2             2
3             3
Apriori

Parameter specification:
 confidence minval smax arem  aval originalSupport maxtime support minlen
        0.8    0.1    1 none FALSE            TRUE       5     0.1      1
 maxlen target   ext
     10  rules FALSE

Algorithmic control:
 filter tree heap memopt load sort verbose
    0.1 TRUE TRUE  FALSE TRUE    2    TRUE

Absolute minimum support count: 100 

set item appearances ...[0 item(s)] done [0.00s].
set transactions ...[100 item(s), 1000 transaction(s)] done [0.00s].
sorting and recoding items ... [31 item(s)] done [0.00s].
creating transaction tree ... done [0.00s].
checking subsets of size 1 2 3 4 5 6 7 8 done [0.01s].
writing ... [8500 rule(s)] done [0.00s].
creating S4 object  ... done [0.00s].
Apriori

Parameter specification:
 confidence minval smax arem  aval originalSupport maxtime support minlen
        0.8    0.1    1 none FALSE            TRUE       5     0.1      1
 maxlen target   ext
     10  rules FALSE

Algorithmic control:
 filter tree heap memopt load sort verbose
    0.1 TRUE TRUE  FALSE TRUE    2    TRUE

Absolute minimum support count: 100 

set item appearances ...[0 item(s)] done [0.00s].
set transactions ...[101 item(s), 1000 transaction(s)] done [0.00s].
sorting and recoding items ... [30 item(s)] done [0.00s].
creating transaction tree ... done [0.00s].
checking subsets of size 1 2 3 4 5 6 7 8 9 done [0.01s].
writing ... [8575 rule(s)] done [0.00s].
creating S4 object  ... done [0.00s].
set of 17075 rules 
set of 9928 rules 

arules documentation built on Nov. 17, 2017, 6:02 a.m.