The wine Data contains a feature called quality with numerical values in the range of 1 to 8. To categorize them, I tried the below code:
wineData$taste <- NA
wineData$taste[which(wineData$quality< 6)] <- bad
wineData$taste[which(wineData$quality>6)] <- excellent
wineData$taste[which(wineData$quality=6)] <- normal
wineData$taste <- factor(wineData$taste)
wineData`
With this code only the quality>6 is categorized as excellent and all others as NA. Why is it not able to categorize the others?
This is the error I'm getting:
wineData$taste[which(wineData$quality>6)] <- excellent Error: object 'excellent' not found wineData$taste[which(wineData$quality==6)] <- normal Error: object 'normal' not found