title: Grouping variables based on location, year and person name
body: <p>I would like to create an aggregate of columns</p>
  
  <pre><code>A&lt;- c("xyz", "xyz", "xy", "xx","xx", "y")
  year&lt;- c(2009,2010,2009,2009,2010,2009)
  location&lt;- c('london', 'london', 'paris', 'newyork','mumbai','sydney')
  df&lt;- data.frame(A, year, location)
  </code></pre>
  
  <p>I would like to create a variable called 'yearsofexperience'which will summarize the total numbers of years spent by one person in a given location. </p>
  
  <pre><code>   A     year         location  yearsofexperience
     xyz  2009          london     2
     xyz  2010          london     2
     xy   2009          paris      1
     xx   2009          newyork    1
     xx   2010          mumbai     1
     y    2009          sydeny     1
  </code></pre>
  
  <p>Can someone help?</p>