Skip to content

How to convert XML file to R Data Frame?

2 messages · Muhammad Bilal, jim holtman

#
Hi All,


I'm new to R and wants to read XML file as R data frame. Is there any package that could be used for this purpose.


I will really appreciate your response.


Many Thanks and


Kind Regards

--
Muhammad Bilal
Research Assistant and PhD Student,
Bristol Enterprise, Research and Innovation Centre (BERIC),
University of the West of England (UWE),
Frenchay Campus,
Bristol,
BS16 1QY

muhammad2.bilal at live.uwe.ac.uk<mailto:olugbenga2.akinade at live.uwe.ac.uk>
#
Check out the XML package for complete information, and the xml2 package
for extracting data from XML.

I don't think you can directly read the XML into a dataframe because of the
hierarchical structure of the data.  There are functions to read an HTML
table into a dataframe.  I think you have to take a close look at your data
and determine what you want from it, then extract the data and put it into
the appropriate structure.  It would have been nice if you at least showed
a sample of the XML was and what you were expecting to get from it.

I have used both of the packages to extract data from moderate files
(~16,000 lines in length).


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Fri, Apr 1, 2016 at 12:08 PM, Muhammad Bilal <
Muhammad2.Bilal at live.uwe.ac.uk> wrote: