I have a data.frame which consists of 12 columns. None of them are categorical variables. However, I want to create one categorical variable out of the first columns (prices in my case) and the split up the data into these 4 categories.
I started out by transforming the csvfile into a data.frame
Next I started ordering the numbers after that one column (I want the categorical variable to be split into "low", "Medium", "high", "very high")
new <- old[order(old$price),]
Next I used the function Cut to cut this one column into 4 intervals.
prices.new <- cut(new$price, breaks=4, labels=c("low","medium","high","very high"))
Now I want to replace the column old$price by prices.new.
new1 <- new[replace(new$price, prices.new)]
However, it always tells me that the value is missing.
I also see a problem because I don't know if the other values will still be comparable after that. ( I want to compare these intervals then with each other with the ANOVA afterwards)