Open Side Menu
Skip to contentBrand Logo
Forums
Inspiration
Ideas
Communities
Blogs
Learning
Support
RegisterSign In
  1. Microsoft Fabric Community
  2. Power BI forums
  3. Galleries
  4. R Script Showcase
Sharon's avatar
Sharon
Microsoft Employee
10 years ago

Association Rules

Description Association rules are ideal to quicly derive insights from large datasets.  The rules are autmatically detected and visualized.    Prerequisites (The sample .pbix files will not...
ScriptInstallPackagesWithWorkaroundsAssorules.R2 KB
Association Rules Showcase_1.0.2.pbix1.1 MB
Advanced Analytics Visualizations
patoduck's avatar
patoduck
Helper III
9 years ago

Hi,

 

I have a table with 2 Columns ID and Product.

I want to Edit the Script in R, but I can't get it to work

How should it be the read.transactions statement?  

> txn <- read.transactions(dataset, rm.duplicates= TRUE,format='basket',sep='','',cols =1)

 

But I get this error...

Error in readLines(file, encoding = encoding) : 'con' is not a connection

 

 

Dataset.xlsx11 KB
boefraty's avatar
boefraty
Microsoft Employee
9 years ago

The data with 2 columns: "TransactionID" and "Product" is indeed very natural. Attached is the PBIX with R code suited to such input.

The relevant data transformation is in lines

nnn = names(dataset)

transData <- as(split(dataset[,nnn[2]], dataset[,nnn[1]]), "transactions")

 

The data in PBIX is synthetic.

assorules_R_visual_ID_Product_synthetic_data.zip69 KB
assorules_R_visual_ID_Product_synthetic_data_no_subset.pbix52 KB
  • surething's avatar
    surething
    New Member
    9 years ago

    Hi, 

     

    I'm trying to use the R script to create association rules for transaction ID and item reference in PBI. I used the script you have in the example but it didn't seem to work. any idea why?  

     

    Thanks 

    • boefraty's avatar
      boefraty
      Microsoft Employee
      9 years ago

      It did not fail, it says "No rules generated" .

      Try to relax thresholds of the rules. If you can to send me PBIX, I will have a look ([email protected]) 

      • HowardCC's avatar
        HowardCC
        Frequent Visitor
        9 years ago

        I get the same msg when using the Showcase .pbix, "No rules generated"

         

        Tried using different tresholds. I think it's due to using R 3.3.3 / 3.3.2.

        Some packages won't load/install under R 3.3.1 using the install-script (were build under R 3.3.3 etc)

         

        Any thoughts?

         

  • © 2026 Microsoft
  • Manage cookies
  • Privacy & cookies
  • Terms of use
  • Trademarks
Your Privacy Choices Consumer Health Privacy