title: How to scale a numeric vector in 1 or 2 steps in R?
body: <p>I have a numeric vector as below:-</p>
  
  <pre><code>num &lt;- c(1.2,2.3,2.4,4.6,1.43,8.99,7.12,6.77,......)
  </code></pre>
  
  <p>This vector is quite a big vector.</p>
  
  <p>What I want to do is to replace all values between 1 and 2 with 1, values between 2 and 3 with 2 and so on.</p>
  
  <pre><code>num_scaled &lt;- c(1,2,2,4,1,8,7,6,.....)
  </code></pre>
  
  <p>Is there any simpler way to do this in R? A function? </p>