Learn R Programming

arules (version 0.2-6)

match: Value Matching

Description

Provides the generic function match and the S4 methods for associations and transactions. match returns a vector of the positions of (first) matches of its first argument in its second.

Usage

match(x,  table, nomatch = NA, incomparables = FALSE)

Arguments

x
an object of class itemMatrix, transactions or associations.
table
a set of associations or transactions to be matched against.
nomatch
the value to be returned in the case when no match is found.
incomparables
not implemented.

Value

  • An integer vector of the same length as x giving the position in table of the first match if there is a match, otherwise nomatch.

See Also

unique, duplicated, rules-class, itemsets-class, itemMatrix-class

Examples

Run this code
data("Adult")

### get unique transactions
vals <- unique(Adult)

### count frequency
cnts <- tabulate(match(Adult, vals))

### plot frequency counts
plot(sort(cnts, decreasing=TRUE))

Run the code above in your browser using DataLab