title: Normalization in R 0 to 5
body: <p>I have a dataframe as follows: </p>
  
  <pre><code>  A       B         C
   ab      gb      0.03
   fn      mn      0.12
   po      er      0.43
   oo      et      0.22
   iu      ew      0.77
   ii      mn      0.14
   dd      wr      0.99
   qw      ty      0.45
  </code></pre>
  
  <p>How do I normalize column C to be from the range of 0-5. I know you can do it like this with dplyr but it doesn't convert it to 0-5. </p>
  
  <pre><code>normalize &lt;- function(x){
    return((x-min(x)) / (max(x)-min(x)))
  }
  
  scaled_data &lt;- 
    df %&gt;%
    group_by(A, B) %&gt;%
    mutate(NORMALIZED = normalize(C))
  </code></pre>