Discretize error message

I am in school and have to learn R Studio for data mining. I am trying to follow a tutorial. However, I keep getting the same errors when I try to discretize. I have installed packages and currently using the library.

here is what happens

bank$age<-discretize(bank$age, "frequency", categories=6)
Warning message:
In discretize(bank$age, "frequency", categories = 6) :
Parameter categories is deprecated. Use breaks instead! Also, the default method is now frequency!

summary(bank$age)
[18,26) [26,35) [35,42) [42,49) [49,59) [59,67]
97 98 98 97 102 108
bank$age<-discretize(bank$age, "frequency", categories=6)
Error in quantile.default(x, probs = seq(0, 1, length.out = breaks + 1), :
(unordered) factors are not allowed
In addition: Warning message:
In discretize(bank$age, "frequency", categories = 6) :
Parameter categories is deprecated. Use breaks instead! Also, the default method is now frequency!

I have never used the arules package but it looks like categories has been changed.

Try

bank$age<-discretize(bank$age,  method = "frequency",  breaks = 6)

I replaced categories with breaks and now I get a different error.

Error in quantile.default(x, probs = seq(0, 1, length.out = breaks + 1), :
(unordered) factors are not allowed

I think that the discretize() function calls for a numeric variable and it looks like R thinks age is a factor.

Try

str(bank)

and see what age is
.
I think we need to see some sample data. A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.