arulesSequences (version 0.2-19)

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

# 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.

See Also

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

Examples

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

Run the code above in your browser using DataCamp Workspace