View source: R/prepareTransactions.R
prepareTransactions | R Documentation |
Data in a data.frame are discretized using class-based discretization and converted into transactions. For transaction data that was not created from a data.frame, a negative class item is added to create data for a binary classifier.
prepareTransactions(formula, data, disc.method = "mdlp", match = NULL)
formula |
the formula. |
data |
a data.frame with the data. |
disc.method |
Discretization method used to discretize continuous
variables if data is a data.frame (default: |
match |
typically |
An object of class transactions
from
arules with an attribute called "disc_info"
that contains
information on the used discretization for each column.
Michael Hahsler
transactions
, transactions2DF
.
# Perform discretization and convert to transactions data("iris") iris_trans <- prepareTransactions(Species ~ ., iris) inspect(head(iris_trans)) # A negative class item is added for regular transaction data (here "!canned beer") # Note: backticks are needed in formulas with item labels that contain a space. data("Groceries") g2 <- prepareTransactions(`canned beer` ~ ., Groceries) inspect(head(g2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.