Hi,

 

I have been able to generate association rules for Market Basket Analysis
using the following codes:

 

****************************************************************************
*******************************************

library("arules")

rules <- read.csv("write1.csv",na.strings=c(".", "NA", "", "?"),header=TRUE)

transactions <- as(split(rules$Item, rules$ID), "transactions")

getrules <- apriori(transactions, parameter = list(support=0.100,
confidence=0.100))

 

summary(getrules)

 

inspect(SORT(getrules, by="confidence")[1:10])

 

****************************************************************************
*******************************************

I am working on a dummy data write now. Following are the rules that inspect
function is showing:

 

****************************************************************************
***************************************

   lhs          rhs           support confidence     lift

1  {Foam}    => {Razor}     0.1000000          1 6.000000

2  {Foam}    => {Toy}       0.1000000          1 6.000000

3  {Foam}    => {Chocolate} 0.1000000          1 4.285714

4  {Razor}   => {Chocolate} 0.1666667          1 4.285714

5  {Toy}     => {Chocolate} 0.1666667          1 4.285714

6  {Ketchup} => {Maggi}     0.3666667          1 2.500000

7  {Butter}  => {Milk}      0.4000000          1 2.500000

8  {Milk}    => {Butter}    0.4000000          1 2.500000

9  {Butter}  => {Bread}     0.4000000          1 2.500000

10 {Bread}   => {Butter}    0.4000000          1 2.500000

****************************************************************************
***********************************************

How do I save these rules in to some other device e.g. Notepad/Document/PPT
etc. I want to be able to save it somewhere in a file and then use it for
presentation.

 

Thanks and regards,

 

Ashish Jha
+91-80-6695 0606

www.zymesolutions.com <http://www.zymesolutions.com/> 

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to