Hi,
I have a problem converting a XML file, via the XML package, to a data.frame.
The XML file looks like this:
<Transaction>
<ID value="0044"/>
<Var1 value="XYZ159"/>
<Var2 value="_"/>
<Var3 value="AMR1.0-INT-1005"/>
<Var4 value="2010-05-25 10:44:16:673"/>
<Var5 value="1"/>
<Var6 value="0"/>
</Transaction>
<Transaction>
<ID value="0046"/>
<Var1 value="XBC254"/>
<Var2 value="GLOBAL"/>
<Var3 value="AMR2.0-INT-9997"/>
<Var4 value="2010-05-25 11:22:50:803"/>
<Var5 value="2"/>
<Var6 value="0"/>
</Transaction>
<Transaction>
<ID value="unknown"/>
<Var1 value="HGF358"/>
<Var2 value="REGION_A"/>
<Var3 value="AMR2.5-INT-1154"/>
<Var4 value="2010-05-24 10:08:26:711"/>
<Var5 value="3"/>
<Var6 value="0"/>
</Transaction>
I don't usually use XML files, but I have searched for an answer for quite a
while. I have tried "xmlToDataFrame" but it demands a structure similar to this:
<top>
<obs>
<var1>value</var1>
<var2>value</var2>
<var3>value</var3>
</obs>
<obs>
<var1>value</var1>
<var2>value</var2>
<var3>value</var3>
</obs>
</top>
The top node "<top>" could in my case maybe be added to the XML file directly
(or via a R command?), but the main issue is to use the children structure in
my file (which is different compared to the one that can be used with the
"xmlToDataFrame"),
<var1 value=""/>
to convert the XML file to a meaningful data.frame with both categorical and
quantitative data.
Any tips or tricks? They are highly appreciated.
Thanks,
Magnus
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.