match

0th

Percentile

Value Matching

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.

%in% is a more intuitive interface as a binary operator, which returns a logical vector indicating if there is a match or not for its left operand.

Keywords
manip
Usage
match(x,  table, nomatch = NA_integer_, incomparables = NULL)x %in% table
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

match: 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.

%in%: A logical vector, indicating if a match was located for each element of x.

rules-class, itemsets-class, itemMatrix-class

Aliases
• match
• %in%
• %in%,itemsets,itemsets-method
• %in%,itemsets,character-method
• match,itemsets,itemsets-method
• match,rules,rules-method
• match,itemMatrix,itemMatrix-method
Examples
# NOT RUN {

## get unique transactions, count frequency of unique transactions
## and plot frequency of unique transactions
plot(sort(cnts, decreasing=TRUE))

## find all transactions which are equal to transaction 10 in Adult

## for transactions we can also match directly with itemLabels.
## Find in the first 10 transactions the ones which
## contain age=Middle-aged (see help page for class itemMatrix)