title: R create range factor levels
body: <p>I would like to automate the following procedure:</p>
  
  <p>Get the min and max from a vector and define a step size from the min to the max given a specific step-size. Each value inside the vector now get's assigned to a <code>label</code> (factor level), that falls into this range e.g. <code>"20-30"</code> when the value is <code>27.45</code>.</p>
  
  <p>At the moment I am using this for-loop</p>
  
  <pre><code>for (label_willi_counter in 1:length(willi)) {
    if(willi[label_willi_counter] &lt; 10)
      label_willi = c(label_willi, "0 - 10")
    else if(willi[label_willi_counter] &lt; 20)
      label_willi = c(label_willi, "10 - 20")
    else if(willi[label_willi_counter] &lt; 30)
      label_willi = c(label_willi, "50 - 30")
    else if(willi[label_willi_counter] &lt; 40)
      label_willi = c(label_willi, "30 - 40")
    else if(willi[label_willi_counter] &lt; 50)
      label_willi = c(label_willi, "40 - 50")
    else if(willi[label_willi_counter] &lt; 60)
      label_willi = c(label_willi, "50 - 60")
    else if(willi[label_willi_counter] &lt; 70)
      label_willi = c(label_willi, "60 - 70")
    else if(willi[label_willi_counter] &lt; 80)
      label_willi = c(label_willi, "70 - 80")
    else if(willi[label_willi_counter] &lt; 90)
      label_willi = c(label_willi, "80 - 90")
    else
      label_willi = c(label_willi, "90 - 100")
  }
  </code></pre>
  
  <p>Well it is working, but I'm sure there is a nicer (and probably faster) approach to do this. This example is fixed for the <code>minimum = 0</code> and <code>maximum = 100</code> and <code>step-size = 10</code>. I'm searching for a more general way to do this.</p>