title: How to extract XML attributes and process these into a dataframe?
body: <p>I am a beginner in R Programming.</p>
  
  <p>I would like to scrape football data from Squawka and place these in a dataframe in order to conduct analyses (newborn hobby of Football Analytics), more precisely from these kind of pages: <a href="http://eredivisie.squawka.com/willem-ii-vs-psv/10-08-2014/dutch-eredivisie/matches" rel="nofollow noreferrer">http://eredivisie.squawka.com/willem-ii-vs-psv/10-08-2014/dutch-eredivisie/matches</a>. </p>
  
  <p>On Stack Overflow I found a thread about how to conduct this: <a href="https://stackoverflow.com/questions/22121006/how-to-scrape-this-squawka-page">how to scrape this squawka page?</a>.</p>
  
  <p>Unfortunately, when I implement the code (see below) that is given in the above-mentioned thread for processing XML attributes/data into a data frame, I receive the following error message:</p>
  
  <blockquote>
    <p>"Error in (function (..., deparse.level = 1, make.row.names = TRUE,
    stringsAsFactors = default.stringsAsFactors())  :    numbers of
    columns of arguments do not match”</p>
  </blockquote>
  
  <pre><code>data &lt;- lapply(example, function(x){ 
    if(length(x['event']) &gt; 0){
      res &lt;- lapply(x['event'], function(y){
      matchAttrs &lt;- as.list(xmlAttrs(y))
      matchAttrs$start &lt;- xmlValue(y['start']$start)
      matchAttrs$end &lt;- xmlValue(y['end']$end)
      matchAttrs
    })
    return(do.call(rbind.data.frame, res))
  }
  }
  )
  </code></pre>
  
  <p>The outcome should be something similar like this:</p>
  
  <pre><code>player_id           mins secs minsec team type  start       end
  event         531    4   39    279   44 Failed 73.1,87.1 97.9,49.1
  event5        311    6   33    393   31 Failed 92.3,13.1 93.0,31.0
  event1        376    8   57    537   31 Failed  97.7,6.1 96.7,16.4
  event6        311   13   50    830   31 Failed  99.5,0.5 94.9,42.6
  event11       311   14   11    851   31 Failed  99.5,0.5 93.1,51.0
  event7        311   17   41   1061   31 Failed 99.5,99.5 92.6,50.1
  </code></pre>
  
  <p>I have tried several other solutions that I found on Stack Overflow that have dealt with similar situations, but till now I did not manage to come up with a proper solution. </p>