I am looking to discretise continuous features in machine-learning datasets, in particular, using supervised discretisation. It turns out that r [has a package/method for this]1, great! But since I am not proficient in R I have some issues and I would greatly appreciate if you could help.
I get an error
class variable needs to be a factor.
I looked at an example online, and they do not seem to have this problem, but I do. Note that I do not quite understand the syntax V2 ~ .
, other than that V2
should be a column name.
library(caret)
library(Rcpp)
library(arulesCBA)
filename <- "wine.data"
dataset <- read.csv(filename, header=FALSE)
dataset2 <- discretizeDF.supervised(V2 ~ ., dataset, method = "mdlp")
R reports the following error:
Error in .parseformula(formula, data) : class variable needs to be a factor!
You may find the dataset wine.data here: https://pastebin.com/hvDbEtMN The first parameter of discretizeDF.supervised is a formula and that seems to be the problem.
Please help! Thank you in advance.