title: How to change discrete ratio data into ordinal data in R?
body: <p>Here is an example:</p>
  
  <pre><code>   height
  1  1.5
  2  1.3 
  3  1.9 
  4  1.5
  5  1.6 
  </code></pre>
  
  <p>There are 1000 of them with height ranging from 0 to 1.9. And I want to cut them into 3 levels: low, medium and high. Then they are ordinal data.</p>
  
  <p>result should look like this:</p>
  
  <pre><code>   height
  1  medium
  2  low
  3  high
  4  medium
  5  medium
  </code></pre>
  
  <p>And the summary should look like:</p>
  
  <pre><code>        height
  low:    203
  medium: 723
  high:   74
  </code></pre>
  
  <p>I tried to use the loop but then "low, medium and high" are characters, not levels.
  Here is how I did the low part:</p>
  
  <pre><code>height_cuts = c(1.5,1.9)
  for(i in 1:nrow(health.sample)){
    if(is.na(health.sample$height[i])==FALSE){
      if(health.sample$height[i] &lt; height_cuts[1]){
        health.sample$height[i] = low_h
      }
    }
  }
  </code></pre>