title: How to add two elements in a single list in R
body: <p>I have a list consisting of 22 dataframes, each dataframe is a sheet from a excel file. Each DF contains a particular cities financial details that I've loaded into R using read_excel function. There a couple of cities where there are two branches hence I need to merge the two cities. How to perform this action in R.</p>
  
  <p>Reproducible script:</p>
  
  <pre><code>&gt; bng1 &lt;- data.frame(parameters = c('cost','emp_count','revenue'), values = c(125,50,200))
  &gt; chn &lt;- data.frame(parameters = c('cost','emp_count','revenue'), values = c(100,45,180))
  &gt; bng2 &lt;- data.frame(parameters = c('cost','emp_count','revenue'), values = c(25,10,100))
  &gt; 
  &gt; mylist &lt;- list(bng1,chn,bng2) #I got my list by creating a function using lapply and read_excel to read data into R
  &gt; mylist 
  [[1]]
    parameters values
  1       cost    125
  2  emp_count     50
  3    revenue    200
  
  [[2]]
    parameters values
  1       cost    100
  2  emp_count     45
  3    revenue    180
  
  [[3]]
    parameters values
  1       cost     25
  2  emp_count     10
  3    revenue    100
  </code></pre>
  
  <p>I need to combine details of bng1 and bng2, I'll then end up with a list consisting of two DFs: chn and bng1 or(2).</p>
  
  <p>Expected output:</p>
  
  <pre><code>mylist
  [[1]]
    parameters  values
  1       cost     150
  2  emp_count      60     
  3    revenue     300
  
  [[2]]
    parameters   values
  1       cost      100 
  2  emp_count       45
  3    revenue      180
  </code></pre>
  
  <p>I have used lapply to add or subtract etc particular rows/columns of a each element in a list using</p>
  
  <pre><code>lapply(list, function(x) x[a,] +/- x[b,])
  </code></pre>
  
  <p>But I have no idea how to merge different elements in a single list. Could someone let me know how to perform the same.</p>