itemFrequency-methods {arulesSequences}R Documentation

Count Items or Itemsets

Description

itemFrequency counts the number of distinct occurrences of items or itemsets (elements) in a collection of sequences. That is, multiple occurrences within a sequence are ignored.

itemTable cross-tabulates the counts an item or itemset occurs in a sequence.

nitems computes the total number of distinct occurrences of items or itemsets in a collection of sequences.

dim retrieves the dimensions of an object of class sequences or timedsequences.

length retrieves the number of elements of a collection of sequences or sequence rules.

Usage

## S4 method for signature 'sequences'
itemFrequency(x, itemsets = FALSE, type = c("absolute", "relative"))

## S4 method for signature 'sequences'
itemTable(x, itemsets = FALSE)

## S4 method for signature 'sequences'
nitems(x, itemsets = FALSE)

## S4 method for signature 'sequences'
dim(x)

## S4 method for signature 'timedsequences'
dim(x)

## S4 method for signature 'sequences'
length(x)

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

Arguments

x

an object.

itemsets

a logical value specifying the type of count.

type

a string value specifying the scale of count.

Value

For itemFrequency returns a vector of counts corresponding with the reference set of distinct items or itemsets.

For itemTable returns a table with the rownames corresponding with the reference set of distinct items or itemsets.

For nitems a scalar value.

For dim and class sequences a vector of length three containing the number of sequences and the dimension of the reference set of distinct itemsets. For class timedsequences the fourth element contains the number of distinct event times.

For length a scalar value.

Note

For efficiency reasons, the reference set of distinct itemsets can be larger than the set actually referenced by a collection of sequences. Thus, the counts of some items or itemsets may be zero.

Method nitems is provided for efficiency; method dim for technical information.

For analysis of a set of rules use the accessors lhs or rhs, or coerce to sequences.

Author(s)

Christian Buchta

See Also

Class sequences, timedsequences, method size, subset.

Examples

## continue example
example(cspade)

##
itemFrequency(s2)
itemFrequency(s2, itemsets = TRUE)

##
itemTable(s2)
itemTable(s2, itemsets = TRUE)

##
nitems(s2)
nitems(s2, itemsets = TRUE)

##
length(s2)
dim(s2)

##
z <- as(zaki, "timedsequences")
dim(z)

[Package arulesSequences version 0.2-25 Index]