transactions2DF: Convert Transactions to a Data.Frame

View source: R/transactions2DF.R

transactions2DFR Documentation

Convert Transactions to a Data.Frame

Description

Convert transactions back into data.frames by combining the items for the same variable into a single column.

Usage

transactions2DF(transactions, itemLabels = FALSE)

Arguments

transactions

an object of class transactions.

itemLabels

logical; use the complete item labels (variable=level) as the levels in the data.frame? By default, only the levels are used.

Value

Returns a data.frame.

Author(s)

Michael Hahsler

See Also

transactions.

Examples


data("iris")
iris_trans <- prepareTransactions(Species ~ ., iris)
iris_trans

# standard conversion
iris_df <- transactions2DF(iris_trans)
head(iris_df)

# use item labels in the data.frame
iris_df2 <- transactions2DF(iris_trans, itemLabels = TRUE)
head(iris_df2)

# Conversion of transactions without variables in itemInfo
data("Groceries")
head(transactions2DF(Groceries), 2)

# Conversion of transactions prepared for classification
g2 <- prepareTransactions(`shopping bags` ~ ., Groceries)
head(transactions2DF(g2), 2)

ianjjohnson/arulesCBA documentation built on June 13, 2022, 2:07 p.m.