Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

DATAFRAME

Data.frame Representation for arules Objects


Description

Provides the generic function DATAFRAME and the S4 methods to create a data.frame representation from some arules objects. based on rules. These methods are used for the coercion to a data.frame, but offers more control over the coercion process (item separators, etc.).

Usage

DATAFRAME(from, ...)

Arguments

from

the object to be converted into a data.frame (rules, itemsets, transactions).

...

further arguments.

Details

Using DATAFRAME is equivalent to the standard coercion as(x, "data.frame"). However, for rules, the argument separate = TRUE will produce separate columns for the LHS and the RHS of the rule. Furthermore, the arguments itemSep, setStart, setEnd (and ruleSep for separate = FALSE) will be passed on to the label method.

Value

a data.frame.

Author(s)

Michael Hahsler

See Also

Examples

data(Adult)
  
DATAFRAME(head(Adult))
DATAFRAME(head(Adult), setStart = '', itemSep = ' + ', setEnd = '')

rules <- apriori(Adult, 
  parameter = list(supp = 0.5, conf = 0.9, target = "rules"))
rules <- head(rules, by = "conf")


### default coercions (same as as(rules, "data.frame"))
DATAFRAME(rules)

DATAFRAME(rules, separate = TRUE)
DATAFRAME(rules, separate = TRUE, setStart = '', itemSep = ' + ', setEnd = '')

arules

Mining Association Rules and Frequent Itemsets

v1.6-7
GPL-3
Authors
Michael Hahsler [aut, cre, cph], Christian Buchta [aut, cph], Bettina Gruen [aut, cph], Kurt Hornik [aut, cph], Ian Johnson [ctb, cph], Christian Borgelt [ctb, cph]
Initial release
2021-03-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.