title: What is the meaning of ~ in aggregate?
body: <pre><code>x &lt;- iris[,1:4]
  names(x) &lt;- c("x1","x2","x3","x4")
  aggregate(x1+x2+x3+x4~x1,FUN=sum,data=x)
  </code></pre>
  
  <p>Here is the output ,i wonder<br>
  1. What is the meaning of <code>~</code> in a formula?<br>
  2. Why <code>x1 = 4.3</code>  ,the <code>x1 + x2 + x3 + x4</code>   is 8.5?  </p>
  
  <p>x1 x1 + x2 + x3 + x4<br>
  1 4.3 8.5<br>
  2 4.4 26.9<br>
  3 4.5 8.4  </p>
  
  <p>when i use </p>
  
  <pre><code> transform(x,x1=sort(x1))
  </code></pre>
  
  <p>what I get is :</p>
  
  <pre><code>     x1  x2  x3  x4  
  1   4.3 3.5 1.4 0.2  
  2   4.4 3.0 1.4 0.2  
  3   4.4 3.2 1.3 0.2  
  4   4.4 3.1 1.5 0.2  
  </code></pre>
  
  <p>（many output omitted)<br>
  When  <code>x1=4.3</code>  ,the <code>x1 + x2 + x3 + x4</code>   is  not  <code>3.5+1.4+0.2=5.1</code> ,nor <code>4.3+3.5+1.4+0.2=9.4</code>?</p>