title: R: sum the elements of each list on a list and return the result in a data frame
body: <p>I have a list of lists in R; each list has the results of a Grep command indicating the position where the search string was found. The command</p>
  
  <pre><code>&gt; matches&lt;-lapply(ListOfFiles, function(x)
  + grep("SearchString",readLines(x),ignore.case = T))
  </code></pre>
  
  <p>produces</p>
  
  <pre><code>//I copy the results that the function actually yields for the sake of the example
  
  &gt; matches&lt;-list(c(11L, 13L), c(9L, 12L, 14L, 15L, 16L, 19L, 20L, 22L, 25L
  + ), c(5L, 8L, 11L), c(10L, 11L, 13L, 14L, 16L), c(5L, 7L, 9L), 
  + integer(0))
  
  &gt; matches
  [[1]]
  [1] 11 13
  
  [[2]]
  [1]  9 12 14 15 16 19 20 22 25
  
  [[3]]
  [1]  5  8 11
  
  [[4]]
  [1] 10 11 13 14 16
  
  [[5]]
  [1] 5 7 9
  
  [[6]]
  integer(0)
  </code></pre>
  
  <p>I need to transform this to a simple data frame of 6 rows and 1 column, with each "cell" having the sum of each of the 6 lists of <code>matches</code>.</p>
  
  <p>If at all possible, please try to explain the syntax I should employ; I'm new to R and sometimes I find examples difficult to follow if several things are nested at once.</p>