R output problem : undefined columns selected

UserBird
Dataiker
R output problem : undefined columns selected

Hello



I have a little problem to solve. I 'm not used to with programing with R in the Dataiku environment. I have this error message when I run my code. I tried numerous combination but nothing to do at the moment :



[2016/04/26-21:46:06.171] [Exec-29] [INFO] [dku.utils]  - > #dkuWriteDataset(transactions, "rules", partition="produitsgood")

[2016/04/26-21:46:06.174] [Exec-30] [INFO] [dku.utils]  - Error in `[.data.frame`(df, i) : undefined columns selected



Thx a lot



 



_____this is my actual code




install.packages("arules",repos="http://cran.rstudio.com/")
library(dataiku)
library(arules)

# Input datasets
transactions <- dkuReadDataset("produits")


# Transform data to make it suitable
transactions <- as(
split(as.vector(transactions$CodeProduit), as.vector(transactions$NumCli)),
"transactions"
)

# Analyze
rules <- apriori(
transactions,
parameter=list(supp=0.02, conf=0.8, target="rules", minlen=2, maxlen=2)
)

rules <- sort(rules, by ="lift")

# Output datasets


dkuWriteDataset(as(rules, "data.frame"), "produitsgood")




 

0 Kudos
2 Replies
Thomas
Dataiker Alumni

Hi Loman,



It looks like you may have 0 record in your "rules" dataset, meaning that the levels of support and confidence are too high to find rules. Try decreasing the values in:




parameter=list(supp=0.02, conf=0.8, target="rules", minlen=2, maxlen=2)


and this may work. 



Thanks

0 Kudos
loman
Level 1
Hello Thomas,


I decreased the degree of confidence. It works perfectly. I'll look a little more deeply how this algorythm work .

thanks again
Merci beaucoup 🙂
0 Kudos

Labels

?
Labels (3)
A banner prompting to get Dataiku