Heba Emam
Heba Emam

Reputation: 1

Error in discretizeDF.supervised(formula, data, method = disc.method) :data needs to be a data.frame

I am using arulesCBA on dataset of words with class attribute which is polarity to be positive or negative. first, I am converting the words to numeric values by using as.numeric function. after that, I am discretizing the columns using this code:

trans.disc <- as.data.frame(lapply(df[2:75], function(x) discretize(x, categories=9)))

in this step, I have warnings that say: parameter categories is deprecated. Use breaks instead! Also, the default method is now frequency!the next step that I am applying is adding the polarity column :

trans.disc$polarity <- df$polarity

the last step, I am trying to build the classifier:

classifier <- CBA(trans.disc, "polarity", supp = 0.05, conf=0.9)

in this phase, there is an error message that says: (Error in discretizeDF.supervised(formula, data, method = disc.method) :data needs to be a data.frame).

Upvotes: 0

Views: 123

Answers (1)

Michael Hahsler
Michael Hahsler

Reputation: 3075

It looks like you have the arguments for CBA moxed up. The man page ?CBA says:

 CBA(
   formula,
   data,
   pruning = "M1",
   parameter = NULL,
   control = NULL,
   balanceSupport = FALSE,
   disc.method = "mdlp",
   verbose = FALSE,
   ...
 )

Upvotes: 0

Related Questions