# subset-methods

0th

Percentile

##### Subset Objects

subset extracts a subset of a collection of sequences or sequence rules which meet conditions specified with respect to their associated (or derived) quality measures, additional information, or patterns of items or itemsets.

[ extracts subsets from a collection of (timed) sequences or sequence rules.

unique extracts the unique set of sequences or sequence rules from a collection of sequences or sequence rules.

lhs, rhs extract the left-hand (antecedent) or right-hand side (consequent) sequences from a collection of sequence rules.

Keywords
manip
##### Usage
# S4 method for sequences
subset(x, subset)# S4 method for sequencerules
subset(x, subset)
# S4 method for sequences
[(x, i, j, ..., reduce = FALSE, drop = FALSE)# S4 method for timedsequences
[(x, i, j, k, ..., reduce = FALSE, drop = FALSE)# S4 method for sequencerules
[(x, i, j, ..., drop = FALSE)# S4 method for sequences
unique(x, incomparables = FALSE)# S4 method for sequencerules
unique(x, incomparables = FALSE)# S4 method for sequencerules
lhs(x)# S4 method for sequencerules
rhs(x)
##### Arguments
x

an object.

subset

an expression specifying the conditions where the columns in quality and info must be referenced by their names, and the object itself as x.

i

a vector specifying the subset of elements to be extracted.

k

a vector specifying the subset of event times to be extracted.

reduce

a logical value specifying if the reference set of distinct itemsets should be reduced if possible.

j, …, drop

unused arguments (for compatibility with package Matrix only).

incomparables

not used.

##### Value

For subset, [, and unique returns an object of the same class as x.

For lhs and rhs returns an object of class '>sequences.

##### Note

In package arules, somewhat confusingly, the object itself has to be referenced as items. We do not provide this, as well as any of the references items, lhs, or rhs.

After extraction the reference set of distinct itemsets may be larger than the set actually referred to unless reduction to this set is explicitly requested. However, this may increase memory consumption.

Event time indexes of mode character are matched against the time labels. Any duplicate indexes are ignored and their order does not matter, i.e. reordering of a sequence is not possible.

The accessors lhs and rhs impute the support of a sequence from the support and confidence of a rule. This may lead to numerically inaccuracies over back-to-back derivations.

Class '>sequences, '>timedsequences, '>sequencerules, method lhs, rhs, match, nitems, c.

##### Aliases
• subset
• subset,sequences-method
• subset,sequencerules-method
• [,sequences-method
• [,timedsequences-method
• [,sequencerules-method
• [,sequences,ANY,ANY,ANY-method
• [,timedsequences,ANY,ANY,ANY-method
• [,sequencerules,ANY,missing,ANY-method
• unique,sequences-method
• unique,sequencerules-method
• unique
• lhs,sequencerules-method
• lhs
• rhs,sequencerules-method
• rhs
##### Examples
# NOT RUN {
## continue example
example(ruleInduction, package = "arulesSequences")

## matching a pattern
as(subset(s2, size(x) > 1), "data.frame")
as(subset(s2, x %ain% c("B", "F")), "data.frame")

## as well as a measure
as(subset(s2, x %ain% c("B", "F") & support == 1), "data.frame")

## matching a pattern in the left-hand side
as(subset(r2, lhs(x) %ain% c("B", "F")), "data.frame")

## matching a derived measure
as(subset(r2, coverage(x) == 1), "data.frame")

## reduce
s <- s2[11, reduce = TRUE]
itemLabels(s)
itemLabels(s2)

## drop initial events
z <- as(zaki, "timedsequences")
summary(z[1,,-1])
# }

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

### Community examples

Looks like there are no examples yet.