Learn R Programming

arulesSequences (version 0.2-1)

subset-methods: 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

## S3 method for class 'sequences':
subset(x, subset)

## S3 method for class 'sequencerules': subset(x, subset)

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

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

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

## S3 method for class 'sequences': unique(x, incomparables = FALSE)

## S3 method for class 'sequencerules': unique(x, incomparables = FALSE)

## S3 method for class 'sequencerules': lhs(x)

## S3 method for class '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.

See Also

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

Examples

Run this code
## 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])

Run the code above in your browser using DataLab