title: Import XML to R data frame
body: <p>I am trying to import an xml file into R. It is of the format below with an event on each row followed by a number of attributes - which ones depend on the event type. This file is 0.7GB and future versions may be much bigger. I would like to create a data frame with each event on a new row and all the possible attributes in separate columns (meaning some will be empty depending on the event type). I have looked elsewhere for answers but they all seem to be dealing with XML files in a tree structure and I can't work out how to apply them to this format.</p>
  
  <p>I am new to R and have no experience with XML files so please give me the "for dummies" answer with plenty of explanation. Thanks!</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;events version="1.0"&gt;
      &lt;event time="21510.0" type="actend" person="3" link="1" actType="h"  /&gt;
      &lt;event time="21510.0" type="departure" person="3" link="1" legMode="car"  /&gt;
      &lt;event time="21510.0" type="PersonEntersVehicle" person="3" vehicle="3"  /&gt;
      &lt;event time="21510.0" type="vehicle enters traffic" person="3" link="1" vehicle="3" networkMode="car" relativePosition="1.0"  /&gt;
  
  ...
  
  &lt;/events&gt;
  </code></pre>