I have some issues when I try to convert my numerical variable into a categorical one. I want to have my column "Price" divided into 20 bins (in order to do a classification tree then).
I tried with the function cut, and it worked, but my intervals are expressed in scientific notation ...
Here is a sample of my data:
Mydata <- data.frame(
Price = c(13500,13750,13950,14950,13750,12950)
)
Here is my code :
Mydata[,2] = cut(Mydata$Price, 3, include.lowest=TRUE)
Then, my 2nd colonne have numbers like (3.11e+04,3.25e+04] for example. I also do with the argument labels = FALSE, but this is not what I'm looking for (then, the bins are expressed in numbers -> 1,2,3, ...,20. I want them to be expressed in intervals -> [0;1000], [1000, 2000], etc...)
Thanks in advance for your help