Provides the generic functions and the methods for itemwise set
operations on items in an itemMatrix. The regular set operations regard each
itemset in an itemMatrix as an element. Itemwise operations regard each item
as an element and operate on the items of pairs of corresponding itemsets
(first itemset in x with first itemset in y, second with second, etc.).
Usage
itemUnion(x, y)
itemSetdiff(x, y)
itemIntersect(x, y)
# S4 method for class 'itemMatrix,itemMatrix'
itemUnion(x, y)
# S4 method for class 'itemMatrix,itemMatrix'
itemSetdiff(x, y)
# S4 method for class 'itemMatrix,itemMatrix'
itemIntersect(x, y)Arguments
- x, y
two itemMatrix objects with the same number of rows (itemsets).
Value
An object of class itemMatrix is returned.
See also
Other itemMatrix and transactions functions:
abbreviate(),
c,
crossTable(),
duplicated(),
extract,
hierarchy,
image,
inspect(),
is.superset(),
itemFrequency(),
itemFrequencyPlot(),
itemMatrix-class,
match(),
merge(),
random.transactions(),
sample(),
sets,
size(),
supportingTransactions(),
tidLists-class,
transactions-class,
unique()
Examples
data("Adult")
fsets <- eclat(Adult, parameter = list(supp = 0.5))
#> Eclat
#>
#> parameter specification:
#> tidLists support minlen maxlen target ext
#> FALSE 0.5 1 10 frequent itemsets TRUE
#>
#> algorithmic control:
#> sparse sort verbose
#> 7 -2 TRUE
#>
#> Absolute minimum support count: 24421
#>
#> create itemset ...
#> set transactions ...[115 item(s), 48842 transaction(s)] done [0.03s].
#> sorting and recoding items ... [9 item(s)] done [0.00s].
#> creating bit matrix ... [9 row(s), 48842 column(s)] done [0.00s].
#> writing ... [49 set(s)] done [0.00s].
#> Creating S4 object ... done [0.00s].
inspect(fsets[1:4])
#> items support count
#> [1] {capital-gain=None,
#> capital-loss=None,
#> hours-per-week=Full-time} 0.5191638 25357
#> [2] {capital-loss=None,
#> hours-per-week=Full-time} 0.5606650 27384
#> [3] {capital-gain=None,
#> hours-per-week=Full-time} 0.5435895 26550
#> [4] {hours-per-week=Full-time,
#> native-country=United-States} 0.5179559 25298
inspect(itemUnion(items(fsets[1:2]), items(fsets[3:4])))
#> items
#> [1] {capital-gain=None,
#> capital-loss=None,
#> hours-per-week=Full-time}
#> [2] {capital-loss=None,
#> hours-per-week=Full-time,
#> native-country=United-States}
inspect(itemSetdiff(items(fsets[1:2]), items(fsets[3:4])))
#> items
#> [1] {capital-loss=None}
#> [2] {capital-loss=None}
inspect(itemIntersect(items(fsets[1:2]), items(fsets[3:4])))
#> items
#> [1] {capital-gain=None, hours-per-week=Full-time}
#> [2] {hours-per-week=Full-time}