Skip to content

xmlToDataFrame#Help!!!

3 messages · Christian Ritter, Dieter Menne, Duncan Temple Lang

#
I'm struggling with interpreting XML files created by ADODB as 
data.frames and I'm looking for advice (see attached example file).

Note:
This file contains a result set which comes from a rectangular data array.
I've been trying to play with parameters to the xmlToDataFrame function 
in the XML package but I dont get it to extract the data frame.

This is what the result should look like:
      Name Sex Age Height Weight
1   Alfred   M  14   69.0  112.5
2    Alice   F  13   56.5   84.0
3  Barbara   F  13   65.3   98.0
4    Carol   F  14   62.8  102.5
5    Henry   M  14   63.5  102.5
6    James   M  12   57.3   83.0
7     Jane   F  12   59.8   84.5
8    Janet   F  15   62.5  112.5
9  Jeffrey   M  13   62.5   84.0
10    John   M  12   59.0   99.5
11   Joyce   F  11   51.3   50.5
12    Judy   F  14   64.3   90.0
13  Louise   F  12   56.3   77.0
14    Mary   F  15   66.5  112.0
15  Philip   M  16   72.0  150.0
16  Robert   M  12   64.8  128.0
17  Ronald   M  15   67.0  133.0
18  Thomas   M  11   57.5   85.0
19 William   M  15   66.5  112.0

Thanks in advance ...

Chris

P.S.:
In return, I'll continue developing a small package called R2sas2R with 
obvious meaning and I'll release it on CRAN as soon as I'm a bit 
further. (first tests under Windows using the StatconnDCOM connector and 
the rcom package are encouraging).
#
Christian Ritter-4 wrote:
xmlToDataFrame is limited to "fairly flat" structures, so maybe your file is
not flat enough. Try first to read in with xmlTreeParse and check for error
message.

Your attached example did not make it; there are limitations for attachments
on this list. So maybe best extract 2 Sample items from your file and
repost.

Dieter
#
Christian Ritter wrote:
You'll have to attach it (or give us a URL for it).

Also, you should tell us what you have tried and how it failed.
And of course, your sessionInfo(). 

 D.