Learn R Programming

arulesSequences (version 0.2-31)

itemFrequency-methods: 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 sequences
itemFrequency(x, itemsets = FALSE, type = c("absolute", "relative"))

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

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

# S4 method for sequences dim(x)

# S4 method for timedsequences dim(x)

# S4 method for sequences length(x)

# S4 method for sequencerules length(x)

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.

Arguments

x

an object.

itemsets

a logical value specifying the type of count.

type

a string value specifying the scale of count.

Author

Christian Buchta

See Also

Class sequences, timedsequences, method size, subset.

Examples

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

Run the code above in your browser using DataLab