Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

R Script arules

Hi there I ran the following script in R studio and it runs successfully.   adult = data(Adult) DATAFRAME(head(Adult)) DATAFRAME(head(Adult), setStart = '', itemSep = ' + ', setEnd = '') rules ...
  • TomMartens's avatar
    9 years ago

    Hey,

     

    you have to add 2 lines of code to your R scrip:

     

    the first line has to be
    library("arules");

    this "loads" the arules library into the Power BI session and you have to explicitly return a dataframe to Power BI, this dataframe will then be treated as a table, so for this reason your last 3 lines of your R script shoud look like this:


    df1 <- DATAFRAME(rules)
    df2 <- DATAFRAME(rules, separate = TRUE)
    df3 <- DATAFRAME(rules, separate = TRUE, setStart = '', itemSep = ' + ', setEnd = '')

     

    Then the Get Dialog will present you 3 dataframes:

     

     

    Hope this helps