subset-methods {arulesSequences}R Documentation

Subset Objects

Description

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.

Usage

## S4 method for signature 'sequences'
subset(x, subset)

## S4 method for signature 'sequencerules'
subset(x, subset)


## S4 method for signature 'sequences'
x[i, j, ..., reduce = FALSE, drop = FALSE]

## S4 method for signature 'timedsequences'
x[i, j, k, ..., reduce = FALSE, drop = FALSE]

## S4 method for signature 'sequencerules'
x[i, j, ..., drop = FALSE]

## S4 method for signature 'sequences'
unique(x, incomparables = FALSE)

## S4 method for signature 'sequencerules'
unique(x, incomparables = FALSE)

## S4 method for signature 'sequencerules'
lhs(x)

## S4 method for signature '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.

Author(s)

Christian Buchta

See Also

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

Examples

## 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])

[Package arulesSequences version 0.2-30 Index]