0 votes
[2017/08/11-20:50:27.790] [Exec-35] [INFO] [dku.utils]  - [1] "********** R code failed **********"
[2017/08/11-20:50:27.791] [Exec-35] [INFO] [dku.utils]  - [1] "Error evaluating R code:  Error in `[.data.frame`(df, i): undefined columns selected\n"
[2017/08/11-20:50:27.854] [FRT-33-FlowRunnable] [INFO] [com.dataiku.dip.dataflow.exec.r.RRecipeRunner] - Error file found, trying to throw it: /home/phani/dataiku-dss-4.0.5/DATA_DIR/jobs/SNAPFISHMARKETBASKET/Build_associations_2017-08-11T15-20-22.942/compute_associations_NP/out-R-EhYvSTHve8dj/error.json
[2017/08/11-20:50:27.864] [FRT-33-FlowRunnable] [INFO] [dku.flow.activity] - Run thread failed for activity compute_associations_NP
com.dataiku.common.server.APIError$SerializedErrorException: Error in R process: simpleError :  undefined columns selected
	at com.dataiku.dip.dataflow.exec.AbstractCodeBasedActivityRunner.execute(AbstractCodeBasedActivityRunner.java:304)
	at com.dataiku.dip.dataflow.exec.AbstractCodeBasedActivityRunner.execute(AbstractCodeBasedActivityRunner.java:231)
	at com.dataiku.dip.recipes.code.r.AbstractRRecipeRunner.executeScript(AbstractRRecipeRunner.java:31)
	at com.dataiku.dip.dataflow.exec.r.RRecipeRunner.run(RRecipeRunner.java:36)
	at com.dataiku.dip.dataflow.jobrunner.ActivityRunner$FlowRunnableThread.run(ActivityRunner.java:353)
[2017/08/11-20:50:27.927] [ActivityExecutor-28] [INFO] [dku.flow.activity] running compute_associations_NP - activity is finished
[2017/08/11-20:50:27.927] [ActivityExecutor-28] [ERROR] [dku.flow.activity] running compute_associations_NP - Activity failed
com.dataiku.common.server.APIError$SerializedErrorException: Error in R process: simpleError :  undefined columns selected
	at com.dataiku.dip.dataflow.exec.AbstractCodeBasedActivityRunner.execute(AbstractCodeBasedActivityRunner.java:304)
	at com.dataiku.dip.dataflow.exec.AbstractCodeBasedActivityRunner.execute(AbstractCodeBasedActivityRunner.java:231)
	at com.dataiku.dip.recipes.code.r.AbstractRRecipeRunner.executeScript(AbstractRRecipeRunner.java:31)
	at com.dataiku.dip.dataflow.exec.r.RRecipeRunner.run(RRecipeRunner.java:36)
	at com.dataiku.dip.dataflow.jobrunner.ActivityRunner$FlowRunnableThread.run(ActivityRunner.java:353)

------------------------------

Following is the code:

library(dataiku)
library(arules)

# Recipe inputs
user_Categories <- dkuReadDataset("User_Categories", samplingMethod="head", nbRows=1)

user_Categories <- as(
  split(as.vector(user_Categories$product_category), as.vector(user_Categories$account_id)),
  "transactions"
)

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

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


# Recipe outputs
dkuWriteDataset(as(rules,"data.frame"),"associations")

 

 

 

asked by anonymous
The error message indicates that you selected a column that does not exist in your data, you can use colnames(user_Categories) to double check column names.
Also, you should try this code in a notebook, it will make debugging easier.

Please log in or register to answer this question.

563 questions
575 answers
421 comments
320 users