Learn R Programming

arules (version 1.7-6)

tidLists-class: Class tidLists --- Transaction ID Lists for Items/Itemsets

Description

Class to represent transaction ID lists and associated methods.

Usage

tidLists(x)

# S4 method for tidLists summary(object, maxsum = 6, ...)

# S4 method for tidLists dim(x)

# S4 method for tidLists dimnames(x)

# S4 method for tidLists,list dimnames(x) <- value

# S4 method for tidLists length(x)

# S4 method for tidLists t(x)

# S4 method for tidLists transactionInfo(x)

# S4 method for tidLists transactionInfo(x) <- value

# S4 method for tidLists itemInfo(object)

# S4 method for tidLists itemInfo(object) <- value

# S4 method for tidLists itemLabels(object)

# S4 method for tidLists labels(object)

Arguments

x, object

the object

maxsum

maximum numbers of itemsets shown in the summary

...

further arguments

value

replacement value

Functions

  • summary(tidLists): create a summary

  • dim(tidLists): get dimensions. The rows represent the itemsets and the columns are the transactions.

  • dimnames(tidLists): get dimnames

  • dimnames(x = tidLists) <- value: replace dimnames

  • length(tidLists): get the number of itemsets.

  • t(tidLists): this object is not transposable. t() results in an error.

  • transactionInfo(tidLists): get the transaction info data.frame

  • transactionInfo(tidLists) <- value: replace the the transaction info data.frame

  • itemInfo(tidLists): get the item info data.frame

  • itemInfo(tidLists) <- value: replace the item info data.frame

  • itemLabels(tidLists): get the item labels

  • labels(tidLists): convert the tid lists into a text representation.

Slots

data

an object of class ngCMatrix from package Matrix.

itemInfo

a data.frame

transactionInfo

a data.frame

Objects from the Class

Objects are created

  • as part of the itemsets mined by eclat() with tidLists = TRUE in the ECparameter object.

  • by supportingTransactions().

  • by coercion from an object of class transactions.

  • by calls of the form new("tidLists", ...).

Coercions

  • as("tidLists", "list")

  • as("list", "tidLists")

  • as("tidLists", "ngCMatrix")

  • as("tidLists", "transactions")

  • as("transactions", "tidLists")

  • as("tidLists", "itemMatrix")

  • as("itemMatrix", "tidLists")

Author

Michael Hahsler

Details

Transaction ID lists contains a set of lists. Each list is associated with an item/itemset and stores the IDs of the transactions which support the item/itemset.

tidLists uses the class Matrix::ngCMatrix to efficiently store the transaction ID lists as a sparse matrix. Each column in the matrix represents one transaction ID list.

tidLists can be used for different purposes. For some operations (e.g., support counting) it is efficient to coerce a transactions database into tidLists where each list contains the transaction IDs for an item (and the support is given by the length of the list).

The implementation of the Eclat mining algorithm (which uses transaction ID list intersection) can also produce transaction ID lists for the found itemsets as part of the returned itemsets object. These lists can then be used for further computation.

See Also

Other itemMatrix and transactions functions: abbreviate(), crossTable(), c(), duplicated(), extract, hierarchy, image(), inspect(), is.superset(), itemFrequencyPlot(), itemFrequency(), itemMatrix-class, match(), merge(), random.transactions(), sample(), sets, size(), supportingTransactions(), transactions-class, unique()

Examples

Run this code
## Create transaction data set.
data <- list(
  c("a","b","c"),
  c("a","b"),
  c("a","b","d"),
  c("b","e"),
  c("b","c","e"),
  c("a","d","e"),
  c("a","c"),
  c("a","b","d"),
  c("c","e"),
  c("a","b","d","e")
  )
data <- as(data, "transactions")
data

## convert transactions to transaction ID lists
tl <- as(data, "tidLists")
tl

inspect(tl)
dim(tl)
dimnames(tl)

## inspect visually
image(tl)

## mine itemsets with transaction ID lists
f <- eclat(data, parameter = list(support = 0, tidLists = TRUE))
tl2 <- tidLists(f)
inspect(tl2)

Run the code above in your browser using DataLab