WRITE {arules}R Documentation

Writes transactions or associations to disk

Description

Provides the generic function WRITE and the S4 methods to write transactions or associations (itemsets, rules) to disk.

Usage

WRITE(x, file = "",...)

Arguments

x the transactions or associations (rules, itemsets, etc.) object.
file either a character string naming a file or a connection open for writing. '""' indicates output to the console.
... further arguments passed on to write.table.

Details

WRITE first uses coercion to data.frame to obtain a printable form of x and then uses write.table to write the data to disk.

Note: To save and load associations in compact form, use save and load from the base package. Alternatively, association can be written to disk in PMML (Predictive Model Markup Language). This requires the packages pmml and XML. See Examples section for usage.

See Also

write.table (in base), transactions-class, associations-class

Examples

data("Epub")

## write the formated result to screen
WRITE(head(Epub))

## write the formated result to file in CSV format
WRITE(Epub, file = "data.csv", sep = ",", col.names = NA)

## write rules in CSV format
rules <- apriori(Epub, parameter=list(support=0.002, conf=0.8))
WRITE(rules, file = "data.csv", sep = ",", col.names = NA)

unlink("data.csv") # tidy up

## write rules as PMML
library(pmml)
rules_pmml <- pmml(rules)
saveXML(rules_pmml, "data.xml")

unlink("data.xml") # tidy up

[Package arules version 1.0-0 Index]