transactions-class {arules} | R Documentation |
The transactions
class represents transaction data used for
mining itemsets or rules. It is a direct extension of class
itemMatrix
to store a binary incidence
matrix, item labels, and optionally transaction IDs and user IDs.
Objects are created by coercion from objects of other classes or by
calls of the form new("transactions", ...)
.
transactionInfo
:"data.frame"
with vectors of the same length as the number of
transactions. Each vector can hold additional information, e.g.,
store transaction IDs or user IDs for each transaction.data
:dgCMatrix
to store the
binary incidence matrix (see
itemMatrix
class)labels
:"data.frame"
to store
item labels (see itemMatrix
class)
Class itemMatrix
, directly.
signature(x = "transactions")
;
extracts a subset from the incidence matrix. The first argument
extracts transactions and the second argument can be used to
extract a subset of items (using item IDs)signature(from = "matrix", to = "transactions")
;
produces a transactions data set from a binary incidence matrix.
The row names are used as item labels and the column names are
stores as transaction IDs.
signature(from = "list", to = "transactions")
;
produces a transactions data set from a list. The names of the
items in the list are used as item labels and the item IDs and the
incidence matrix is produced automatically.
signature(from = "transactions", to = "matrix")
signature(from = "transactions", to = "list")
signature(from = "data.frame", to = "transactions")
;
recodes the data frame containing only categorical variables (all
have to be factors) into a binary transaction data set. The needed
number of dummy items are automatically generated. The item
labels are generated by concatenating variable names and levels with
a "=".
The variable names and levels are stored in the labels data frame
as the components variables
and levels
.signature(x = "transactions")
;
plots an image of the transactions for visual inspectionsignature(x = "transactions")
;
replaces the transactionInfo data framesignature(x = "transactions")
;
returns transactionInfosignature(object = "transactions")
signature(object = "transactions")
Michael Hahsler
data("Adult") ## Coerce the Adult data.frame to transactions. Adult_transactions <- as(Adult, "transactions") summary(Adult_transactions) image(Adult_transactions[1:500,1:100])