1

Hi I have a problem with one of my assignments. I am using the following dataset http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv One of the questions asks to "reduce the levels of rating for quality to three levels as high, medium, and low". I would like to output the summary of the quality variable to these strings. They are originally as integers

joran
  • 169,992
  • 32
  • 429
  • 468
tytds
  • 61
  • 1
  • 2
  • Possible duplicate of [Cleaning up factor levels (collapsing multiple levels/labels)](https://stackoverflow.com/questions/19410108/cleaning-up-factor-levels-collapsing-multiple-levels-labels) – Shree Aug 02 '19 at 19:11

1 Answers1

0

If it is a homework you should really try to get part of the solution yourself nevertheless here are helping ideas:

  1. You want to cut or bin the variables. E.g. you have a scale of 1-6, you could cut it into three groups of 1-2,3-4 and 5-6.

  2. Once you have cut or binned your variables you can transform the binned variable (which is now a factor) to the desired levels by using transformations like "5-6" -> "high".

Can you provide as least some code you have already worked on and where your problems are? Then I could provide better feedback instead of just providing a solution.

Fnguyen
  • 1,159
  • 10
  • 23