title: Scaling data in R gives spurious Error "length of 'center' must equal the number of columns of 'x'"
body: <p>I am trying to scale a data.frame in the range of 0 and 1 using the following code:</p>
  
  <pre><code>for(i in 1:nrow(data))
  {
    x &lt;- data[i, ]
    data[i, ] &lt;- scale(x, min(x), max(x)-min(x))
  }
  
  Data:
   x1   x2  x3  x4  x5  x6  x7  x8  x9  x10  x11  x12  x13  x14  x15  x16  x17 
   15   6   6   0   9   3   1   4   5    1    1   13    0    0   20    5   28
   2  24  14   7   0  15   7   0  11   3    3    4   15    7    0   30    0  344
   3  10   5   2   0   6   2   0   5   0    0    2    7    1    0   11    0  399
   4   9   4   2   0   5   2   0   4   0    0    2    6    1    0   10    0   28
   5   6   2   1   0   3   1   0   2   0    0    1    3    1    0    6    0   82
   6   9   4   2   0   5   2   0   4   0    0    2    6    1    0   10    0   42
  </code></pre>
  
  <p>But I am getting the following error message:</p>
  
  <pre><code>Error in scale.default(x, min(x), max(x) - min(x)) (from #4) : 
    length of 'center' must equal the number of columns of 'x'
  </code></pre>