mardi 4 août 2015

Parsing XML in R data stored in attributes with blanks

I am trying to parse the data contained in an XML file using R. I would like the data to be read into a dataframe. The data is located at the following URL:

http://ift.tt/1eQcG7T

I have reviewed some similar posts on stackoverflow such as How to convert xml data to data frame in R but I still cannot seem to get them to work. One issue I ran into is that some of the values are empty and then appear like this:

<Cell Textbox73="filler" /> 

The general key value pair is structured as follows:

<m1_attribute_group>
   <s3 attribute1="Trade 2/">
       <s4>
           <Cell cell_value1="372.02"/>
       </s4>
   </s3>
</m1_attribute_group>

Is there any way to parse this file quickly with xmlToDataFrame() or xmlAttrsToDataFrame() or do I have to build custom functions to apply over the list of nodes?

Aucun commentaire:

Enregistrer un commentaire