title: Summarize the values of a column based on the values of more than two columns of the same dataframe
body: <p>I have the dataframe below. </p>
  
  <pre><code>year&lt;-c(2016,2016,2017,2017,2016,2016,2017,2017)
  city&lt;-c("NY","NY","NY","NY","WS","WS","WS","WS")
  spec&lt;-c("df","df","df","df","vb","vb","vb","vb")
  num&lt;-c(45,67,89,90,45,67,89,90)
  df&lt;-data.frame(year,city,spec,num)
  </code></pre>
  
  <p>I would like to know if it is possible to sum the <code>num</code> based on <code>year</code>,<code>city</code> and <code>spec</code> columns in order to bring it from this form:</p>
  
  <pre><code>year city spec num
  1 2016   NY   df  45
  2 2016   NY   df  67
  3 2017   NY   df  89
  4 2017   NY   df  90
  5 2016   WS   vb  45
  6 2016   WS   vb  67
  7 2017   WS   vb  89
  8 2017   WS   vb  90
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>year city spec num
  1 2016   NY   df 112
  2 2017   NY   df 179
  3 2016   WS   vb 112
  4 2017   WS   vb 179
  </code></pre>