# match-methods

0th

Percentile

##### Match Objects

match finds the positions of first matches of a collection of sequences or sequence rules in an object of the same class.

%in% indicates matches of the left in the right operand. If the right operand is a vector of item labels indicates if a sequence contains any of the items given.

%ain% indicates if a sequence contains all the items given as the right operand.

%pin% indicates if a sequence contains any item matching the regular expression given as the right operand.

%ein% indicates if a sequence contains any itemset containing all the items given as the right operand.

duplicated indicates duplicate occurrences of sequences or sequence rules.

Keywords
manip
##### Usage
# S4 method for sequences,sequences
match(x, table, nomatch = NA_integer_, incomparables = NULL)# S4 method for sequencerules,sequencerules
match(x, table, nomatch = NA_integer_, incomparables = NULL)## S4 methods for signature 'sequences, character':
x %in%  table
x %ain% table
x %pin% table
x %ein% table# S4 method for sequences
duplicated(x, incomparables = FALSE)# S4 method for sequencerules
duplicated(x, incomparables = FALSE)
##### Arguments
x

an object.

table

an object (of the same class as x).

nomatch

the value to be returned in the case of no match.

incomparables

not used.

##### Value

For match returns an integer vector of the same length as x containing the position in table of the first match, or if there is no match the value of nomatch.

For %in%, %ain%, and %pin% returns a logical vector indicating for each element of x if a match was found in the right operand.

For duplicated a logical vector corresponding with the elements of x.

##### Note

For practical reasons, the item labels given in the right operand must match the item labels associated with x exactly.

Currently, an operator for matching against the labels of a set of sequences is not provided. For example, it could be defined as

"%lin%" <- function(l, r) match(r, labels(l)) > 0

with the caveat of being too general.

FIXME currently matching of timed sequences does not take event times into consideration.

Class '>sequences, '>sequencerules, method labels, itemLabels.

##### Aliases
• match
• match,sequences,sequences-method
• %in%,sequences,sequences-method
• match,sequencerules,sequencerules-method
• %in%,sequences,character-method
• %in%
• %ain%,sequences,character-method
• %ain%
• %pin%,sequences,character-method
• %pin%
• %ein%,sequences,character-method
• %ein%
• duplicated,sequences-method
• duplicated,sequencerules-method
• duplicated
##### Examples
# NOT RUN {
## continue example

## match
labels(s1[match(s2, s1)])
labels(s1[s1 %in% s2])	    # the same

## match items
labels(s2[s2 %in%  c("B", "F")])
labels(s2[s2 %ain% c("B", "F")])
labels(s2[s2 %pin% "F"])

## match itemsets
labels(s1[s1 %ein% c("F","B")])
# }

Documentation reproduced from package arulesSequences, version 0.2-19, License: GPL-2

### Community examples

Looks like there are no examples yet.